git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Sitaram Chamarty <sitaramc@gmail.com>
Date
Feb 26, 2009, 03:48 UTC
Message-ID
<slrngqc47n.t1k.sitaramc@sitaramc.homelinux.net>
In-Reply-To
<slrngqbrpd.t1k.sitaramc@sitaramc.homelinux.net>
On 2009-02-26, Sitaram Chamarty <sitaramc@gmail.com> wrote:
> On 2009-02-25, Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
> I see you've used 'pattern' and 'sign' to break the
> overloading of '/'.
>
>>     - 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
>
> I wish[1].  But in reality, a slash 'inside' anchors the
> match the same as a leading slash does.
>
> Boy this is tough :-) and I'm almost tempted to relook at my
> first attempt, where your only concerns were the words
> 'otherwise' and 'anywhere else' for non-native speakers.
>
> I'll think about this some more and get back to you.
How about this:
----8<----
    - an optional leading ! symbol meaning "unignore paths
      that match this pattern, instead of ignoring them"
    - an optional trailing / symbol meaning "this pattern
      matches only with a directory (i.e., files and
      symlinks won't match)"
    - the above two symbols (if present) are then removed.
      What remains is treated as a normal shell glob
      pattern, with the additional restriction that if the
      pattern still contains a slash, it matches only at the
      current directory and not in its subdirectories
----8<----

I'm not going into the 'descend' thing; based on how the email from Björn Steinbrink plays out, we can describe that later. Same for 'current directory', which stands for the root of the work-tree if the pattern came from .git/info/exclude or a core.excludesfile; this also can be added as a footnote.

Previous: Sitaram ChamartyNext: Junio C Hamano
Message 12 of 15 in “How do I qualify paths in the .gitignore file w.r.t. the repo root directory?”
  1. Brent GoodrickFeb 24, 2009
  2. Junio C HamanoFeb 24, 2009
  3. Sitaram ChamartyFeb 24, 2009
  4. Junio C HamanoFeb 24, 2009
  5. Sitaram ChamartyFeb 24, 2009
  6. Sitaram ChamartyFeb 25, 2009
  7. Junio C HamanoFeb 25, 2009
  8. Sitaram ChamartyFeb 25, 2009
  9. Junio C HamanoFeb 25, 2009
  10. Björn SteinbrinkFeb 26, 2009
  11. Sitaram ChamartyFeb 26, 2009
  12. Sitaram ChamartyFeb 26, 2009
  13. Junio C HamanoFeb 26, 2009
  14. Brent GoodrickFeb 25, 2009
  15. Sitaram ChamartyFeb 25, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.