Git development
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Sitaram Chamarty <sitaramc@gmail.com>, git@vger.kernel.org
Subject: Re: How do I qualify paths in the .gitignore file w.r.t. the repo root  directory?
Date: Thu, 26 Feb 2009 01:45:30 +0100	[thread overview]
Message-ID: <20090226004530.GA11730@atjola.homenet> (raw)
In-Reply-To: <7vvdqyyzsr.fsf@gitster.siamese.dyndns.org>

On 2009.02.25 13:25:24 -0800, Junio C Hamano wrote:
> Sitaram Chamarty <sitaramc@gmail.com> 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

  reply	other threads:[~2009-02-26  0:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-24  6:47 How do I qualify paths in the .gitignore file w.r.t. the repo root directory? Brent Goodrick
2009-02-24  7:06 ` Junio C Hamano
2009-02-24  9:07   ` Sitaram Chamarty
2009-02-24 17:33     ` Junio C Hamano
2009-02-24 18:31       ` Sitaram Chamarty
2009-02-25  3:31       ` Sitaram Chamarty
2009-02-25  8:36         ` Junio C Hamano
2009-02-25 11:17           ` Sitaram Chamarty
2009-02-25 21:25             ` Junio C Hamano
2009-02-26  0:45               ` Björn Steinbrink [this message]
2009-02-26  1:23               ` Sitaram Chamarty
2009-02-26  3:48                 ` Sitaram Chamarty
2009-02-26 17:04                   ` Junio C Hamano
2009-02-25  1:14   ` Brent Goodrick
2009-02-25  4:01     ` Sitaram Chamarty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090226004530.GA11730@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sitaramc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox