Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Sitaram Chamarty <sitaramc@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: How do I qualify paths in the .gitignore file w.r.t. the repo root  directory?
Date: Wed, 25 Feb 2009 13:25:24 -0800	[thread overview]
Message-ID: <7vvdqyyzsr.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: slrngqaa5n.mp1.sitaramc@sitaramc.homelinux.net

Sitaram Chamarty <sitaramc@gmail.com> writes:

> On 2009-02-25, Junio C Hamano <gitster@pobox.com> wrote:
> ...
>> '!' is not part of _how_ the patterns match.  It is _what happens_ when a
>> pattern marked as such matches (meaning, the syntax for a line in
>> gitignore file is "an optional '!' followed by a pattern").
>>
>>     An optional prefix '!' is not a part of the pattern and it does not
>>     affect the match.  When a path matches such a pattern, instead of
>>     being ignored, it is unignored.
>
> I can use this.  Can we keep it in the same section, despite
> being technically not a '_how_'?  It fits the other sections
> even less, and the sectioning is the main thing in all this.

I thought making the text easier to follow was the main thing.

Sectioning could be part of the solution, but if we find that the boundary
between sections are blurry, or if there are too many sections compared to
the number of rules, perhaps dividing them into sections and giving each a
separate section header may make them even harder to follow.

I am actually very tempted to say that the correct description of the
gitignore language is:

    - an optional ! sign whose meaning is "unignore paths that matches
      this pattern, instead of ignoring them"; followed by

    - an optional / sign whose meaning is "a match with this pattern must
      be made at this directory and not in its subdirectories"; followed
      by

    - a pattern that never begins nor ends with a slash whose meaning is
      "this is a shell glob pattern to test paths against"; followed by

    - an optional / sign whose meaning is "this pattern matches only with
      a directory".

We'll need to tweak the language a bit in J6t's patch that talks about the
gitattributes pattern if we go this route, though.  The attribute system
uses the latter three that specify how a match is made, but does not use
the first one that specifies what happens once a match is found, because
the latter is done by the attributes part that follows the pattern in the
gitattributes file.

> 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.

>>> This is _where_ the patterns match (a trailing slash is
>>> ignored for these rules):
>>> ...
> And it'll _seem to_ contradict what we say, just above, that
> a trailing slash is ignored for these rules.

You are absolutely right.  Please scratch my comment on this item.

  reply	other threads:[~2009-02-25 21:27 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 [this message]
2009-02-26  0:45               ` Björn Steinbrink
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=7vvdqyyzsr.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --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