Re: [RFC/PATCH] git-add: Don't exclude explicitly-specified tracked files
- From
Greg Brockman <gdb@mit.edu>
- Date
- Aug 12, 2010, 20:19 UTC
- Message-ID
- <AANLkTikDvcn4eFDdkv26ADzsipwD_ofkdYwu_0abeLA3@mail.gmail.com>
- In-Reply-To
- <7viq3fsirv.fsf@alter.siamese.dyndns.org>
Show 11 quoted lines
>> First of all, as you point out 'git add foo.pdf' works where foo.pdf >> has been explicitly ignored, while in contrast 'git add dir/file' >> fails when file has only been indirectly ignored because it is in an >> ignored directory. In the former case, the user explicitly specified >> a policy for that file. In the later case, the policy is only >> indirectly expressed because that file happens to be in an ignored >> directory. > > Sorry, but I don't get this argument. When the user says "everything in > this directory is ignored", why does it make it less direct than "this > particular file is ignored"?
In general, I view the presence of a dir entry in a .gitignore as the user setting a default policy for files in that directory, but the user might actually mean for there to be some exceptions to that policy.
For example, in my personal usage, when I ignore a directory but track some files within it, this is because I don't want to specify an ignore for every single other file in that directory. Also note that negated .gitignore entries don't seem to work in this case, i.e. a .gitignore with contents dir !dir/file won't actually let file be addable again.
In contrast, when I add dir/file to a .gitignore, there is no doubt that I want to ignore that particular file.
Does that make more sense?
Greg