All of lore.kernel.org
 help / color / mirror / Atom feed
* 2.8.0 gitignore enhancement not working as expected
@ 2016-03-18  9:31 Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
  2016-03-18 11:19 ` Duy Nguyen
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco) @ 2016-03-18  9:31 UTC (permalink / raw)
  To: git

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

Is this a bug or am I mis-understanding what the enhancement does? Or is this the known limitation referred to?

Thanks,

Richard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.8.0 gitignore enhancement not working as expected
  2016-03-18  9:31 2.8.0 gitignore enhancement not working as expected Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
@ 2016-03-18 11:19 ` Duy Nguyen
  2016-03-18 14:32   ` Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
  0 siblings, 1 reply; 5+ messages in thread
From: Duy Nguyen @ 2016-03-18 11:19 UTC (permalink / raw)
  To: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco); +Cc: git

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: 2.8.0 gitignore enhancement not working as expected
  2016-03-18 11:19 ` Duy Nguyen
@ 2016-03-18 14:32   ` Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
  2016-03-18 14:52     ` Duy Nguyen
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco) @ 2016-03-18 14:32 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: git

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@gmail.com]
> Sent: 18 March 2016 11:19
> To: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
> <rfurness@cisco.com>
> Cc: git@vger.kernel.org
> 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@cisco.com> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.8.0 gitignore enhancement not working as expected
  2016-03-18 14:32   ` Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
@ 2016-03-18 14:52     ` Duy Nguyen
  2016-03-18 15:33       ` Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
  0 siblings, 1 reply; 5+ messages in thread
From: Duy Nguyen @ 2016-03-18 14:52 UTC (permalink / raw)
  To: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco); +Cc: git

On Fri, Mar 18, 2016 at 9:32 PM, Richard Furness -X (rfurness - ENSOFT
LIMITED at Cisco) <rfurness@cisco.com> wrote:
> 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:

Thank you. Phew.. I bet you hit the same bug we found yesterday (your
trace suggests so). Can you try this patch [1] just to confirm?

[1] http://article.gmane.org/gmane.comp.version-control.git/289101
-- 
Duy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: 2.8.0 gitignore enhancement not working as expected
  2016-03-18 14:52     ` Duy Nguyen
@ 2016-03-18 15:33       ` Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco) @ 2016-03-18 15:33 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: git

Hi Duy,

That seems to have fixed it :-)

Thanks for your help!

Richard

> -----Original Message-----
> From: Duy Nguyen [mailto:pclouds@gmail.com]
> Sent: 18 March 2016 14:53
> To: Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
> <rfurness@cisco.com>
> Cc: git@vger.kernel.org
> Subject: Re: 2.8.0 gitignore enhancement not working as expected
> 
> On Fri, Mar 18, 2016 at 9:32 PM, Richard Furness -X (rfurness - ENSOFT
> LIMITED at Cisco) <rfurness@cisco.com> wrote:
> > 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:
> 
> Thank you. Phew.. I bet you hit the same bug we found yesterday (your
> trace suggests so). Can you try this patch [1] just to confirm?
> 
> [1] http://article.gmane.org/gmane.comp.version-control.git/289101
> --
> Duy

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-18 15:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-18  9:31 2.8.0 gitignore enhancement not working as expected Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
2016-03-18 11:19 ` Duy Nguyen
2016-03-18 14:32   ` Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)
2016-03-18 14:52     ` Duy Nguyen
2016-03-18 15:33       ` Richard Furness -X (rfurness - ENSOFT LIMITED at Cisco)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.