Hi Duy, I tried your exact example and it worked correctly. But then I tried adding some more files/dirs at the top level and I still see an issue: cat .gitignore /* !a/b/c find * -type f 1 2 3 a/1 a/b/1 a/b/c/1 d/1 git ls-files -o --exclude-standard .gitignore 2 3 a/b/c/1 d/1 Trace output below... Thanks, Richard GIT_TRACE_EXCLUDE=1 git ls-files -o --exclude-standard 07:26:13.311793 dir.c:1848 exclude: [0] enter '' 07:26:13.312632 dir.c:1012 exclude: from .gitignore 07:26:13.312668 dir.c:1097 exclude: 1 vs /* at line 1 => yes 07:26:13.312673 dir.c:1012 exclude: from .gitignore 07:26:13.312677 dir.c:1089 exclude: a vs /* at line 1 => yes, forced open by a/b/c at line 2 => n/a 07:26:13.312681 dir.c:1012 exclude: from /users/rfurness/.gitignore_global 07:26:13.312684 dir.c:1062 exclude: a => n/a 07:26:13.312699 dir.c:1848 exclude: [1] enter 'a/' 07:26:13.312964 dir.c:1012 exclude: from .gitignore 07:26:13.312978 dir.c:1089 exclude: a vs /* at line 1 => yes, forced open by a/b/c at line 2 => n/a 07:26:13.312981 dir.c:1012 exclude: from /users/rfurness/.gitignore_global 07:26:13.312985 dir.c:1062 exclude: a => n/a 07:26:13.312991 dir.c:1012 exclude: from .gitignore 07:26:13.312995 dir.c:1097 exclude: a/1 vs /* at line 1 => yes (stuck) 07:26:13.312999 dir.c:1012 exclude: from .gitignore 07:26:13.313002 dir.c:1089 exclude: a/b vs /* at line 1 => yes, forced open by a/b/c at line 2 => n/a 07:26:13.313006 dir.c:1012 exclude: from /users/rfurness/.gitignore_global 07:26:13.313009 dir.c:1062 exclude: a/b => n/a 07:26:13.313016 dir.c:1848 exclude: [2] enter 'a/b/' 07:26:13.313259 dir.c:1012 exclude: from .gitignore 07:26:13.313272 dir.c:1089 exclude: a/b vs /* at line 1 => yes, forced open by a/b/c at line 2 => n/a 07:26:13.313275 dir.c:1012 exclude: from /users/rfurness/.gitignore_global 07:26:13.313279 dir.c:1062 exclude: a/b => n/a 07:26:13.313285 dir.c:1012 exclude: from .gitignore 07:26:13.313288 dir.c:1097 exclude: a/b/1 vs /* at line 1 => yes (stuck) 07:26:13.313292 dir.c:1012 exclude: from .gitignore 07:26:13.313295 dir.c:1097 exclude: a/b/c vs a/b/c at line 2 => no 07:26:13.313303 dir.c:1848 exclude: [3] enter 'a/b/c/' 07:26:13.313601 dir.c:1012 exclude: from .gitignore 07:26:13.313615 dir.c:1097 exclude: a/b/c vs a/b/c at line 2 => no 07:26:13.313632 dir.c:1012 exclude: from .gitignore 07:26:13.313636 dir.c:1097 exclude: a/b/c/1 vs a/b/c at line 2 => no 07:26:13.313645 dir.c:1914 exclude: [3] leave 'a/b/c/' 07:26:13.313650 dir.c:1914 exclude: [2] leave 'a/b/' 07:26:13.313655 dir.c:1914 exclude: [1] leave 'a/' 07:26:13.313716 dir.c:1012 exclude: from .gitignore 07:26:13.313720 dir.c:1062 exclude: .gitignore => n/a 07:26:13.313724 dir.c:1012 exclude: from /users/rfurness/.gitignore_global 07:26:13.313727 dir.c:1062 exclude: .gitignore => n/a 07:26:13.313742 dir.c:1012 exclude: from .gitignore 07:26:13.313746 dir.c:1062 exclude: 2 => n/a 07:26:13.313748 dir.c:1012 exclude: from /users/rfurness/.gitignore_global 07:26:13.313752 dir.c:1062 exclude: 2 => n/a 07:26:13.313789 dir.c:1012 exclude: from .gitignore 07:26:13.313793 dir.c:1062 exclude: 3 => n/a 07:26:13.313846 dir.c:1012 exclude: from /users/rfurness/.gitignore_global 07:26:13.313848 dir.c:1062 exclude: 3 => n/a 07:26:13.313852 dir.c:1012 exclude: from .gitignore 07:26:13.313855 dir.c:1062 exclude: d => n/a 07:26:13.313857 dir.c:1012 exclude: from /users/rfurness/.gitignore_global 07:26:13.313860 dir.c:1062 exclude: d => n/a 07:26:13.314145 dir.c:1848 exclude: [1] enter 'd/' 07:26:13.314395 dir.c:1012 exclude: from .gitignore 07:26:13.314425 dir.c:1062 exclude: d => n/a 07:26:13.314430 dir.c:1012 exclude: from /users/rfurness/.gitignore_global 07:26:13.314435 dir.c:1062 exclude: d => n/a 07:26:13.314455 dir.c:1012 exclude: from .gitignore 07:26:13.314459 dir.c:1062 exclude: d/1 => n/a 07:26:13.314462 dir.c:1012 exclude: from /users/rfurness/.gitignore_global 07:26:13.314465 dir.c:1062 exclude: d/1 => n/a 07:26:13.314471 dir.c:1914 exclude: [1] leave 'd/' 07:26:13.314475 dir.c:1914 exclude: [0] leave '' .gitignore 2 3 a/b/c/1 d/1 > -----Original Message----- > From: Duy Nguyen [mailto:pclouds@xxxxxxxxx] > Sent: 18 March 2016 11:19 > To: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco) > <rfurness@xxxxxxxxx> > Cc: git@xxxxxxxxxxxxxxx > Subject: Re: 2.8.0 gitignore enhancement not working as expected > > On Fri, Mar 18, 2016 at 4:31 PM, Richard Furness -X (rfurness - ENSOFT > LIMITED at Cisco) <rfurness@xxxxxxxxx> wrote: > > 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 ��.n��������+%������w��{.n��������n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�