-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignored files populated by chezmoiexternal are not ignored #3559
Comments
❯ docker run -it alpine:latest
/ # apk update
...
OK: 22982 distinct packages available
/ # apk add curl
...
OK: 12 MiB in 23 packages
/ # apk add neovim
...
OK: 34 MiB in 34 packages
/ # sh -c "$(curl -fsLS get.chezmoi.io)"
info found version 2.46.1 for latest/linux/amd64
info installed ./bin/chezmoi
/ # chezmoi init
/ # cd $(chezmoi source-path)
~/.local/share/chezmoi # nvim .chezmoiexternal.toml
~/.local/share/chezmoi # cat .chezmoiexternal.toml
{{- if eq .chezmoi.os "linux" }}
["bin/starship"]
type = "archive-file"
url = "https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz"
path = "starship"
["bin/fastfetch"]
type = "archive-file"
url = "https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-x86_64.zip"
path = "fastfetch-linux-x86_64/usr/bin/fastfetch"
{{- end }}
~/.local/share/chezmoi # nvim .chezmoiignore
~/.local/share/chezmoi # cat .chezmoiignore
README.md
{{- if ne .chezmoi.os "linux" }}
bin/fastfetch
bin/starship
{{- end }}
~/.local/share/chezmoi # chezmoi apply
~/.local/share/chezmoi # cd
~ # chezmoi add ./bin
~ # chezmoi managed
chezmoi: bin/fastfetch: inconsistent state (/root/.local/share/chezmoi/bin/executable_fastfetch, https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-x86_64.zip defined in /root/.local/share/chezmoi/.chezmoiexternal.toml)
bin/starship: inconsistent state (/root/.local/share/chezmoi/bin/executable_starship, https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz defined in /root/.local/share/chezmoi/.chezmoiexternal.toml) |
Yes, I reproduced it with alpine as well: ~/.local/share/chezmoi # git status
On branch master
nothing to commit, working tree clean
~/.local/share/chezmoi # tree .
.
└── bin
├── bar
└── foo
1 directories, 2 files
~/.local/share/chezmoi # cat .chezmoiexternal.toml .chezmoiignore
{{- if eq .chezmoi.os "linux" }}
["bin/starship"]
type = "archive-file"
url = "https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz"
path = "starship"
["bin/fastfetch"]
type = "archive-file"
url = "https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-x86_64.zip"
path = "fastfetch-linux-x86_64/usr/bin/fastfetch"
{{- end }}
README.md
{{- if ne .chezmoi.os "linux" }}
bin/fastfetch
bin/starship
{{- end }}
~/.local/share/chezmoi # tree ~/bin/
/root/bin/
├── bar
├── fastfetch
├── foo
└── starship
0 directories, 4 files
~/.local/share/chezmoi # chezmoi add ~/bin/
~/.local/share/chezmoi # chezmoi managed
chezmoi: bin/fastfetch: inconsistent state (/root/.local/share/chezmoi/bin/executable_fastfetch, https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-x86_64.zip defined in /root/.local/share/chezmoi/.chezmoiexternal.toml)
bin/starship: inconsistent state (/root/.local/share/chezmoi/bin/executable_starship, https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz defined in /root/.local/share/chezmoi/.chezmoiexternal.toml)
~/.local/share/chezmoi # git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
bin/executable_fastfetch
bin/executable_starship
nothing added to commit but untracked files present (use "git add" to track) |
executable = true
Wait, that's not correct. |
Under the hood, this is the same issue as #1574. Note that What's happening here is that two files which are already defined in chezmoi should not allow files to be added if they're already defined as externals. I'll update the description of #1574. |
Describe the bug
Two files are populated by
.chezmoiexternal
.The same two files are also ignored in
.chezmoiignore
.Those files are not ignored.
To reproduce
Test on Linux:
Expected behavior
fastfetch
andstarship
are ignored by chezmoi on Linux and not added to the source state (thus they do not show up in git status).Output of command with the
--verbose
flagchezmoi $ git clean -fd && chezmoi --verbose add ~/bin
No output, return code 0
Output of
chezmoi doctor
Additional context
In
~/bin
there are scripts that are managed by chezmoi so I cannot just ignore ~/binThe text was updated successfully, but these errors were encountered: