You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The gitignore handling by vcsh is confusing. It does seem to work as intended,
but there are confusing error messages:
lotus:~% vcsh init bugdemo
Initialized empty Git repository in /home/madduck/.config/vcsh/repo.d/bugdemo.git/
vcsh: info: '/home/madduck/.gitignore.d/bugdemo' differs from new data, moving it to '/home/madduck/.gitignore.d/bugdemo.bak'
The following paths are ignored by one of your .gitignore files:
.gitignore.d
hint: Use -f if you really want to add them.
hint: Disable this message with "git config advice.addIgnoredFile false"
[main (root-commit) ca6eacc] seed gitignore file
1 file changed, 2 insertions(+)
create mode 100644 .gitignore.d/bugdemo
That message about having to use -f is confusing, especially since I haven't
called git-add. Update: except I did… there's a hook that does it. So my fault. But the issue still stands.
Let's move on:
lotus:~% vcsh enter bugdemo
+lotus:vcsh:bugdemo|main|~% mkdir -p sub/dir
+lotus:vcsh:bugdemo|main|~% date > sub/dir/date
+lotus:vcsh:bugdemo|main|~% git add sub/dir/date
The following paths are ignored by one of your .gitignore files:
sub
hint: Use -f if you really want to add them.
hint: Disable this message with "git config advice.addIgnoredFile false"
Okay, that makes perfect sense. It's a new file. Moving right along…
+lotus:vcsh:bugdemo|main|~% git add -f sub/dir/date
+lotus:vcsh:bugdemo|main|~% vcsh write-gitignore bugdemo
vcsh: info: '/home/madduck/.gitignore.d/bugdemo' differs from new data, moving it to '/home/madduck/.gitignore.d/bugdemo.bak'
+lotus:vcsh:bugdemo|main|~% git add .gitignore.d/bugdemo
The following paths are ignored by one of your .gitignore files:
.gitignore.d
hint: Use -f if you really want to add them.
hint: Disable this message with "git config advice.addIgnoredFile false"
Yeah well, .gitignore.d is ignored, but I am not trying to do anything with
that directory. The file I am actually adding is excluded from gitignore,
and it is also properly staged:
+lotus:vcsh:bugdemo|main|~% git status
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: .gitignore.d/bugdemo
new file: sub/dir/date
The same happens with any other file:
+lotus:vcsh:bugdemo|main|~% git commit -am.
[main 35cec3a] .
2 files changed, 2 insertions(+)
create mode 100644 sub/dir/date
+lotus:vcsh:bugdemo|main|~% cat .gitignore.d/bugdemo
*
!/.gitignore.d/bugdemo
!/sub/dir/date
+lotus:vcsh:bugdemo|main|~% date >| sub/dir/date
+lotus:vcsh:bugdemo|main|~% git add sub/dir/date
The following paths are ignored by one of your .gitignore files:
sub
hint: Use -f if you really want to add them.
hint: Disable this message with "git config advice.addIgnoredFile false"
+lotus:vcsh:bugdemo|main|~% git status
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: sub/dir/date
The way to fix this is IMHO by adding exclusions for all parent directories,
i.e. the .gitignore.d/bugdemo file should be:
Thanks for the detailed report. Without actually having dived into the nitty gritty yet, this seems like it is probably a regression related to #196/#334. Somewhene in between #311 also touched the ignore code.
The gitignore handling by vcsh is confusing. It does seem to work as intended,
but there are confusing error messages:
That message about having to use
-f
is confusing, especially since I haven'tcalled
git-add
. Update: except I did… there's a hook that does it. So my fault. But the issue still stands.Let's move on:
Okay, that makes perfect sense. It's a new file. Moving right along…
Yeah well,
.gitignore.d
is ignored, but I am not trying to do anything withthat directory. The file I am actually adding is excluded from
gitignore
,and it is also properly staged:
The same happens with any other file:
The way to fix this is IMHO by adding exclusions for all parent directories,
i.e. the
.gitignore.d/bugdemo
file should be:I believe this was the case in the past, and has changed. FTR, setting
VCSH_GITIGNORE=recursive
has no effect on the above.The text was updated successfully, but these errors were encountered: