Re: How do I qualify paths in the .gitignore file w.r.t. the repo root directory?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2009.02.25 13:25:24 -0800, Junio C Hamano wrote:
> Sitaram Chamarty <sitaramc@xxxxxxxxx> writes:
> > Do we not want to specify that we don't descend?  The
> > original text does say '...will match a directory foo and
> > paths underneath it'.
> 
> Ok.  If we unignore a directory that does not mean all paths inside it are
> now unignored --- they are still subject to .gitignore rules read from it
> and its subdirectories.  So "will match it and paths inside it" is correct
> but "will ignore it and paths inside it" is not.

I don't think that's good enough. The case in which we ignore
directories is impressively hard to describe correctly. Consider this:

.gitignore     # Contains foo
foo/.gitignore # Contains !bar
foo/bar

The current man page says that for "foo/bar" foo/.gitignore has the
highest precedence, overriding the patterns from .gitignore. So without
further information, one could think that while foo/bar is matched by
the "foo" pattern, this is invalidated by the "!bar" rule and thus
foo/bar would not be ignored. But of course we don't bother looking into
foo at all, so the foo/.gitignore has no effect.

And it gets more interesting:

.gitignore # Contains "foo" and "!foo/bar"
foo/bar

Even in this case, foo/bar is ignored. Because again, we don't look into
foo at all, so we never even see foo/bar and thus we won't notice that
it is to be unignored. So saying "match it and paths inside it" is
misleading, because we'll never even see any path inside it that could
match, and it might lead to failing gitignore setups like the above.

So maybe instead of "... and paths inside it", we could have something
like this:

    If a directory is ignored, git won't look into it at all when
    searching for untracked files. This means that all paths inside it
    are implicitly ignored and that you cannot unignore these paths.

Björn
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux