Re: "git add $ignored_file" fail
- From
- Santi <sbejar@gmail.com>
- Date
- May 16, 2006, 22:42 UTC
- Message-ID
- <8aa486160605161542u704ccf03w@mail.gmail.com>
- In-Reply-To
- <Pine.LNX.4.64.0605161526210.16475@g5.osdl.org>
2006/5/17, Linus Torvalds <torvalds@osdl.org>:
Show 28 quoted lines
> > > On Wed, 17 May 2006, Santi wrote: > > > > When you try to add ignored files with the git-add command it > > fails because the call to: > > > > git-ls-files -z \ > > --exclude-from="$GIT_DIR/info/exclude" \ > > --others --exclude-per-directory=.gitignore > > > > does not output this file because it is ignored. I know I can do it with: > > > > git-update-index --add $ignored_file > > > > I understand the behaviour of git-ls-files but I think it is no the > > expected for git-add, at least for me. > > Well, the thing is, git-add doesn't really take a "file name", it takes a > filename _pattern_. > > Clearly we can't add everything that matches the pattern, because one > common case is to add a whole subdirectory, and thus clearly the > .gitignore file must override the pattern. > > So it's consistent that it overrides it also for a single filename case, > no? >
It's consistent from an implementation point of view, but not from the (my?) user point of view. This is why I say I understand it for git-ls-files. For the case of git-add even the usage and the man page talk about <file>...
Clearly for the case of a whole subdirectory, or even ".", the .gitignore file must override the pattern, but not for the case of a pattern that is a single existing file.
Santi