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

Re: 2.8.0 gitignore enhancement not working as expected

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 18, 2016, 11:19 UTC
Message-ID
<CACsJy8Bjv=fF0CSNF_QNTCYCqQjy=j0ZEyjYOBFscz0HEYATig@mail.gmail.com>
In-Reply-To
<4a4980485c234280bce91be87d213216@XCH-RCD-003.cisco.com>

On Fri, Mar 18, 2016 at 4:31 PM, Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco) <rfurness@cisco.com> wrote:

Show 21 quoted lines
> Hi,
>
> I've been testing out git 2.8.0 rc3 due to having a particular interest in this enhancement from the changelog:
> " Another try to improve the ignore mechanism that lets you say "this
>    is excluded" and then later say "oh, no, this part (that is a
>    subset of the previous part) is not excluded".  This has still a
>    known limitation, though."
>
> Currently, in order to include ONLY the files under a/b/c I have the following in .gitignore:
> /*             - Ignore everything
> !/a             - Except directory "a"
> /a/*            - Ignore all sub-directories of "a/"
> !/a/b           - Except "a/b"
> /a/b/*          - Ignore all sub-directories of "a/b/"
> !/a/b/c         - Except "a/b/c"
>
> My hope was that with this enhancement I could massively simplify this to:
> /*             - Ignore everything
> !a/b/c      - Except "a/b/c"
>
> However this doesn't seem to work - instead I find that NOTHING is ignored (i.e. it's as if the 2nd line completely cancels the first).
Interesting. It seems to be working for me. This is my test setup
> /tmp/abc $ find * -type f

1 a/1 a/b/1 a/b/c

> /tmp/abc $ cat .gitignore

/* !a/b/c

and the results
> /tmp/abc $ ~/w/git/temp/git --version
git version 2.8.0.rc3
> /tmp/abc $ ~/w/git/temp/git ls-files -o --exclude-standard
a/b/c

Can you do "GIT_TRACE_EXCLUDE=1 git ls-files -o --exclude-standard" and post the output?

-- 
Duy
Previous: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)Next: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
Message 2 of 5 in “2.8.0 gitignore enhancement not working as expected”
  1. Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)Mar 18, 2016
  2. Duy NguyenMar 18, 2016
  3. Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)Mar 18, 2016
  4. Duy NguyenMar 18, 2016
  5. Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)Mar 18, 2016

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.