Skip to content

Commit 01eef45

Browse files
committed
feat: Warn if the user is using the Helix editor with chezmoi edit
1 parent f3fc511 commit 01eef45

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

internal/cmd/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,6 +2495,9 @@ func (c *Config) runEditor(args []string) error {
24952495
if err != nil {
24962496
return err
24972497
}
2498+
if c.Edit.Hardlink && filepath.Base(editor) == "hx" {
2499+
c.errorf("warning: helix editor cannot edit hardlinks, see https://github.com/helix-editor/helix/issues/11279 and https://github.com/twpayne/chezmoi/issues/3971")
2500+
}
24982501
start := time.Now()
24992502
err = c.run(chezmoi.EmptyAbsPath, editor, editorArgs)
25002503
if runtime.GOOS != "windows" && c.Edit.MinDuration != 0 {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[windows] skip
2+
3+
chmod 777 bin/hx
4+
5+
# test that chezmoi edit prints a warning if the editor is hx (helix) with hardlinks enabled
6+
exec chezmoi edit $HOME${/}.file
7+
stderr 'warning: helix editor cannot edit hardlinks'
8+
9+
-- bin/hx --
10+
#!/bin/sh
11+
12+
echo "helix 24.7 (079f5442)"
13+
-- home/user/.config/chezmoi/chezmoi.toml --
14+
[edit]
15+
command = "hx"
16+
hardlink = true
17+
-- home/user/.local/share/chezmoi/dot_file --
18+
# contents of .file

0 commit comments

Comments
 (0)