{"thread":{"id":"41736","subject":"2.8.0 gitignore enhancement not working as expected","startedAt":"2016-03-18T09:31:21Z","lastAt":"2016-03-18T15:33:26Z","messageCount":5,"participants":["Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"281138","messageId":"4a4980485c234280bce91be87d213216@XCH-RCD-003.cisco.com","threadId":"41736","inReplyTo":null,"subject":"2.8.0 gitignore enhancement not working as expected","fromName":"Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)","fromEmail":"rfurness@cisco.com","sentAt":"2016-03-18T09:31:21Z","receivedAt":"2016-03-18T09:31:21Z","isPatch":false,"sender":{"key":"rfurness@cisco.com","avatar":null},"body":"Hi,\n\nI've been testing out git 2.8.0 rc3 due to having a particular interest in this enhancement from the changelog:\n\" Another try to improve the ignore mechanism that lets you say \"this\n   is excluded\" and then later say \"oh, no, this part (that is a\n   subset of the previous part) is not excluded\".  This has still a\n   known limitation, though.\"\n\nCurrently, in order to include ONLY the files under a/b/c I have the following in .gitignore:\n/*             - Ignore everything\n!/a             - Except directory \"a\"\n/a/*            - Ignore all sub-directories of \"a/\"\n!/a/b           - Except \"a/b\"\n/a/b/*          - Ignore all sub-directories of \"a/b/\"\n!/a/b/c         - Except \"a/b/c\"\n\nMy hope was that with this enhancement I could massively simplify this to:\n/*             - Ignore everything\n!a/b/c      - Except \"a/b/c\"\n\nHowever 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).\n\nIs this a bug or am I mis-understanding what the enhancement does? Or is this the known limitation referred to?\n\nThanks,\n\nRichard\n"},{"id":"281140","messageId":"CACsJy8Bjv=fF0CSNF_QNTCYCqQjy=j0ZEyjYOBFscz0HEYATig@mail.gmail.com","threadId":"41736","inReplyTo":"4a4980485c234280bce91be87d213216@XCH-RCD-003.cisco.com","subject":"Re: 2.8.0 gitignore enhancement not working as expected","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-03-18T11:19:25Z","receivedAt":"2016-03-18T11:19:25Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Mar 18, 2016 at 4:31 PM, Richard Furness -X (rfurness - ENSOFT\nLIMITED at Cisco) <rfurness@cisco.com> wrote:\n> Hi,\n>\n> I've been testing out git 2.8.0 rc3 due to having a particular interest in this enhancement from the changelog:\n> \" Another try to improve the ignore mechanism that lets you say \"this\n>    is excluded\" and then later say \"oh, no, this part (that is a\n>    subset of the previous part) is not excluded\".  This has still a\n>    known limitation, though.\"\n>\n> Currently, in order to include ONLY the files under a/b/c I have the following in .gitignore:\n> /*             - Ignore everything\n> !/a             - Except directory \"a\"\n> /a/*            - Ignore all sub-directories of \"a/\"\n> !/a/b           - Except \"a/b\"\n> /a/b/*          - Ignore all sub-directories of \"a/b/\"\n> !/a/b/c         - Except \"a/b/c\"\n>\n> My hope was that with this enhancement I could massively simplify this to:\n> /*             - Ignore everything\n> !a/b/c      - Except \"a/b/c\"\n>\n> 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).\n\nInteresting. It seems to be working for me. This is my test setup\n\n> /tmp/abc $ find * -type f\n1\na/1\na/b/1\na/b/c\n> /tmp/abc $ cat .gitignore\n/*\n!a/b/c\n\nand the results\n\n> /tmp/abc $ ~/w/git/temp/git --version\ngit version 2.8.0.rc3\n> /tmp/abc $ ~/w/git/temp/git ls-files -o --exclude-standard\na/b/c\n\nCan you do \"GIT_TRACE_EXCLUDE=1 git ls-files -o --exclude-standard\"\nand post the output?\n-- \nDuy\n"},{"id":"281145","messageId":"551499517627471db2c8434077eb16db@XCH-RCD-003.cisco.com","threadId":"41736","inReplyTo":"CACsJy8Bjv=fF0CSNF_QNTCYCqQjy=j0ZEyjYOBFscz0HEYATig@mail.gmail.com","subject":"RE: 2.8.0 gitignore enhancement not working as expected","fromName":"Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)","fromEmail":"rfurness@cisco.com","sentAt":"2016-03-18T14:32:27Z","receivedAt":"2016-03-18T14:32:27Z","isPatch":false,"sender":{"key":"rfurness@cisco.com","avatar":null},"body":"Hi Duy,\n\nI 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:\n\ncat .gitignore\n/*\n!a/b/c\n\nfind * -type f\n1\n2\n3\na/1\na/b/1\na/b/c/1\nd/1\n\ngit ls-files -o --exclude-standard\n.gitignore\n2\n3\na/b/c/1\nd/1\n\nTrace output below...\n\nThanks,\n\nRichard\n\n\nGIT_TRACE_EXCLUDE=1 git ls-files -o --exclude-standard\n07:26:13.311793 dir.c:1848              exclude: [0] enter ''\n07:26:13.312632 dir.c:1012              exclude: from .gitignore\n07:26:13.312668 dir.c:1097              exclude: 1 vs /* at line 1 => yes\n07:26:13.312673 dir.c:1012              exclude: from .gitignore\n07:26:13.312677 dir.c:1089              exclude: a vs /* at line 1 => yes, forced open by a/b/c at line 2 => n/a\n07:26:13.312681 dir.c:1012              exclude: from /users/rfurness/.gitignore_global\n07:26:13.312684 dir.c:1062              exclude: a => n/a\n07:26:13.312699 dir.c:1848              exclude: [1] enter 'a/'\n07:26:13.312964 dir.c:1012              exclude: from .gitignore\n07:26:13.312978 dir.c:1089              exclude: a vs /* at line 1 => yes, forced open by a/b/c at line 2 => n/a\n07:26:13.312981 dir.c:1012              exclude: from /users/rfurness/.gitignore_global\n07:26:13.312985 dir.c:1062              exclude: a => n/a\n07:26:13.312991 dir.c:1012              exclude: from .gitignore\n07:26:13.312995 dir.c:1097              exclude: a/1 vs /* at line 1 => yes (stuck)\n07:26:13.312999 dir.c:1012              exclude: from .gitignore\n07: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\n07:26:13.313006 dir.c:1012              exclude: from /users/rfurness/.gitignore_global\n07:26:13.313009 dir.c:1062              exclude: a/b => n/a\n07:26:13.313016 dir.c:1848              exclude: [2] enter 'a/b/'\n07:26:13.313259 dir.c:1012              exclude: from .gitignore\n07: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\n07:26:13.313275 dir.c:1012              exclude: from /users/rfurness/.gitignore_global\n07:26:13.313279 dir.c:1062              exclude: a/b => n/a\n07:26:13.313285 dir.c:1012              exclude: from .gitignore\n07:26:13.313288 dir.c:1097              exclude: a/b/1 vs /* at line 1 => yes (stuck)\n07:26:13.313292 dir.c:1012              exclude: from .gitignore\n07:26:13.313295 dir.c:1097              exclude: a/b/c vs a/b/c at line 2 => no\n07:26:13.313303 dir.c:1848              exclude: [3] enter 'a/b/c/'\n07:26:13.313601 dir.c:1012              exclude: from .gitignore\n07:26:13.313615 dir.c:1097              exclude: a/b/c vs a/b/c at line 2 => no\n07:26:13.313632 dir.c:1012              exclude: from .gitignore\n07:26:13.313636 dir.c:1097              exclude: a/b/c/1 vs a/b/c at line 2 => no\n07:26:13.313645 dir.c:1914              exclude: [3] leave 'a/b/c/'\n07:26:13.313650 dir.c:1914              exclude: [2] leave 'a/b/'\n07:26:13.313655 dir.c:1914              exclude: [1] leave 'a/'\n07:26:13.313716 dir.c:1012              exclude: from .gitignore\n07:26:13.313720 dir.c:1062              exclude: .gitignore => n/a\n07:26:13.313724 dir.c:1012              exclude: from /users/rfurness/.gitignore_global\n07:26:13.313727 dir.c:1062              exclude: .gitignore => n/a\n07:26:13.313742 dir.c:1012              exclude: from .gitignore\n07:26:13.313746 dir.c:1062              exclude: 2 => n/a\n07:26:13.313748 dir.c:1012              exclude: from /users/rfurness/.gitignore_global\n07:26:13.313752 dir.c:1062              exclude: 2 => n/a\n07:26:13.313789 dir.c:1012              exclude: from .gitignore\n07:26:13.313793 dir.c:1062              exclude: 3 => n/a\n07:26:13.313846 dir.c:1012              exclude: from /users/rfurness/.gitignore_global\n07:26:13.313848 dir.c:1062              exclude: 3 => n/a\n07:26:13.313852 dir.c:1012              exclude: from .gitignore\n07:26:13.313855 dir.c:1062              exclude: d => n/a\n07:26:13.313857 dir.c:1012              exclude: from /users/rfurness/.gitignore_global\n07:26:13.313860 dir.c:1062              exclude: d => n/a\n07:26:13.314145 dir.c:1848              exclude: [1] enter 'd/'\n07:26:13.314395 dir.c:1012              exclude: from .gitignore\n07:26:13.314425 dir.c:1062              exclude: d => n/a\n07:26:13.314430 dir.c:1012              exclude: from /users/rfurness/.gitignore_global\n07:26:13.314435 dir.c:1062              exclude: d => n/a\n07:26:13.314455 dir.c:1012              exclude: from .gitignore\n07:26:13.314459 dir.c:1062              exclude: d/1 => n/a\n07:26:13.314462 dir.c:1012              exclude: from /users/rfurness/.gitignore_global\n07:26:13.314465 dir.c:1062              exclude: d/1 => n/a\n07:26:13.314471 dir.c:1914              exclude: [1] leave 'd/'\n07:26:13.314475 dir.c:1914              exclude: [0] leave ''\n.gitignore\n2\n3\na/b/c/1\nd/1\n\n\n> -----Original Message-----\n> From: Duy Nguyen [mailto:pclouds@gmail.com]\n> Sent: 18 March 2016 11:19\n> To: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)\n> <rfurness@cisco.com>\n> Cc: git@vger.kernel.org\n> Subject: Re: 2.8.0 gitignore enhancement not working as expected\n> \n> On Fri, Mar 18, 2016 at 4:31 PM, Richard Furness -X (rfurness - ENSOFT\n> LIMITED at Cisco) <rfurness@cisco.com> wrote:\n> > Hi,\n> >\n> > I've been testing out git 2.8.0 rc3 due to having a particular interest in this\n> enhancement from the changelog:\n> > \" Another try to improve the ignore mechanism that lets you say \"this\n> >    is excluded\" and then later say \"oh, no, this part (that is a\n> >    subset of the previous part) is not excluded\".  This has still a\n> >    known limitation, though.\"\n> >\n> > Currently, in order to include ONLY the files under a/b/c I have the\n> following in .gitignore:\n> > /*             - Ignore everything\n> > !/a             - Except directory \"a\"\n> > /a/*            - Ignore all sub-directories of \"a/\"\n> > !/a/b           - Except \"a/b\"\n> > /a/b/*          - Ignore all sub-directories of \"a/b/\"\n> > !/a/b/c         - Except \"a/b/c\"\n> >\n> > My hope was that with this enhancement I could massively simplify this to:\n> > /*             - Ignore everything\n> > !a/b/c      - Except \"a/b/c\"\n> >\n> > However this doesn't seem to work - instead I find that NOTHING is\n> ignored (i.e. it's as if the 2nd line completely cancels the first).\n> \n> Interesting. It seems to be working for me. This is my test setup\n> \n> > /tmp/abc $ find * -type f\n> 1\n> a/1\n> a/b/1\n> a/b/c\n> > /tmp/abc $ cat .gitignore\n> /*\n> !a/b/c\n> \n> and the results\n> \n> > /tmp/abc $ ~/w/git/temp/git --version\n> git version 2.8.0.rc3\n> > /tmp/abc $ ~/w/git/temp/git ls-files -o --exclude-standard\n> a/b/c\n> \n> Can you do \"GIT_TRACE_EXCLUDE=1 git ls-files -o --exclude-standard\"\n> and post the output?\n> --\n> Duy\n"},{"id":"281146","messageId":"CACsJy8BfySC0extNWmKHgF1QOoEzGtg5RxgpfsNxjp8HJ_rdXQ@mail.gmail.com","threadId":"41736","inReplyTo":"551499517627471db2c8434077eb16db@XCH-RCD-003.cisco.com","subject":"Re: 2.8.0 gitignore enhancement not working as expected","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-03-18T14:52:37Z","receivedAt":"2016-03-18T14:52:37Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Mar 18, 2016 at 9:32 PM, Richard Furness -X (rfurness - ENSOFT\nLIMITED at Cisco) <rfurness@cisco.com> wrote:\n> Hi Duy,\n>\n> 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:\n\nThank you. Phew.. I bet you hit the same bug we found yesterday (your\ntrace suggests so). Can you try this patch [1] just to confirm?\n\n[1] http://article.gmane.org/gmane.comp.version-control.git/289101\n-- \nDuy\n"},{"id":"281149","messageId":"20118f38fdbb48af99292e69648fd7e9@XCH-RCD-003.cisco.com","threadId":"41736","inReplyTo":"CACsJy8BfySC0extNWmKHgF1QOoEzGtg5RxgpfsNxjp8HJ_rdXQ@mail.gmail.com","subject":"RE: 2.8.0 gitignore enhancement not working as expected","fromName":"Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)","fromEmail":"rfurness@cisco.com","sentAt":"2016-03-18T15:33:26Z","receivedAt":"2016-03-18T15:33:26Z","isPatch":false,"sender":{"key":"rfurness@cisco.com","avatar":null},"body":"Hi Duy,\n\nThat seems to have fixed it :-)\n\nThanks for your help!\n\nRichard\n\n> -----Original Message-----\n> From: Duy Nguyen [mailto:pclouds@gmail.com]\n> Sent: 18 March 2016 14:53\n> To: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)\n> <rfurness@cisco.com>\n> Cc: git@vger.kernel.org\n> Subject: Re: 2.8.0 gitignore enhancement not working as expected\n> \n> On Fri, Mar 18, 2016 at 9:32 PM, Richard Furness -X (rfurness - ENSOFT\n> LIMITED at Cisco) <rfurness@cisco.com> wrote:\n> > Hi Duy,\n> >\n> > I tried your exact example and it worked correctly. But then I tried adding\n> some more files/dirs at the top level and I still see an issue:\n> \n> Thank you. Phew.. I bet you hit the same bug we found yesterday (your\n> trace suggests so). Can you try this patch [1] just to confirm?\n> \n> [1] http://article.gmane.org/gmane.comp.version-control.git/289101\n> --\n> Duy\n"}]}