{"thread":{"id":"35294","subject":"[PATCH 0/2] Improve gitignore documentation wrt excluded directories","startedAt":"2013-11-07T16:30:05Z","lastAt":"2013-11-07T22:43:22Z","messageCount":11,"participants":["Karsten Blees","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"230198","messageId":"527BC00D.8000501@gmail.com","threadId":"35294","inReplyTo":null,"subject":"[PATCH 0/2] Improve gitignore documentation wrt excluded directories","fromName":"Karsten Blees","fromEmail":"karsten.blees@gmail.com","sentAt":"2013-11-07T16:30:05Z","receivedAt":"2013-11-07T16:30:05Z","isPatch":true,"sender":{"key":"karsten.blees@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1111200?v=4"},"body":"Also here:\nhttps://github.com/kblees/git/commits/kb/gitignore-doc\n\nThese two patches were the result of a discussion mid-october [1] that I almost forgot about...now including an example as suggested by Jeff.\n\n[1] http://thread.gmane.org/gmane.comp.version-control.git/235753/focus=235856\n\nKarsten Blees (2):\n  gitignore.txt: fix documentation of \"**\" patterns\n  gitignore.txt: clarify recursive nature of excluded directories\n\n Documentation/gitignore.txt | 24 +++++++++++++++++++-----\n 1 file changed, 19 insertions(+), 5 deletions(-)\n\n-- \n1.8.4.msysgit.0.12.g88f5ed0\n"},{"id":"230199","messageId":"527BC037.2000106@gmail.com","threadId":"35294","inReplyTo":"527BC00D.8000501@gmail.com","subject":"[PATCH 1/2] gitignore.txt: fix documentation of \"**\" patterns","fromName":"Karsten Blees","fromEmail":"karsten.blees@gmail.com","sentAt":"2013-11-07T16:30:47Z","receivedAt":"2013-11-07T16:30:47Z","isPatch":true,"sender":{"key":"karsten.blees@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1111200?v=4"},"body":"\"**\" means bold in ASCIIDOC, so we need to escape it.\n\nSigned-off-by: Karsten Blees <blees@dcon.de>\n---\n Documentation/gitignore.txt | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\nindex 54e334e..f971960 100644\n--- a/Documentation/gitignore.txt\n+++ b/Documentation/gitignore.txt\n@@ -113,12 +113,12 @@ full pathname may have special meaning:\n \n  - A leading \"`**`\" followed by a slash means match in all\n    directories. For example, \"`**/foo`\" matches file or directory\n-   \"`foo`\" anywhere, the same as pattern \"`foo`\". \"**/foo/bar\"\n+   \"`foo`\" anywhere, the same as pattern \"`foo`\". \"`**/foo/bar`\"\n    matches file or directory \"`bar`\" anywhere that is directly\n    under directory \"`foo`\".\n \n- - A trailing \"/**\" matches everything inside. For example,\n-   \"abc/**\" matches all files inside directory \"abc\", relative\n+ - A trailing \"`/**`\" matches everything inside. For example,\n+   \"`abc/**`\" matches all files inside directory \"`abc`\", relative\n    to the location of the `.gitignore` file, with infinite depth.\n \n  - A slash followed by two consecutive asterisks then a slash\n-- \n1.8.4.msysgit.0.12.g88f5ed0\n"},{"id":"230200","messageId":"527BC068.3040303@gmail.com","threadId":"35294","inReplyTo":"527BC00D.8000501@gmail.com","subject":"[PATCH 2/2] gitignore.txt: clarify recursive nature of excluded directories","fromName":"Karsten Blees","fromEmail":"karsten.blees@gmail.com","sentAt":"2013-11-07T16:31:36Z","receivedAt":"2013-11-07T16:31:36Z","isPatch":true,"sender":{"key":"karsten.blees@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1111200?v=4"},"body":"Additionally, precedence of negated patterns is exactly as outlined in\nthe DESCRIPTION section, we don't need to repeat this.\n\nSigned-off-by: Karsten Blees <blees@dcon.de>\n---\n Documentation/gitignore.txt | 18 ++++++++++++++++--\n 1 file changed, 16 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\nindex f971960..5ecc48e 100644\n--- a/Documentation/gitignore.txt\n+++ b/Documentation/gitignore.txt\n@@ -79,8 +79,9 @@ PATTERN FORMAT\n \n  - An optional prefix \"`!`\" which negates the pattern; any\n    matching file excluded by a previous pattern will become\n-   included again.  If a negated pattern matches, this will\n-   override lower precedence patterns sources.\n+   included again. It is not possible to re-include a file if a parent\n+   directory of that file is excluded (i.e. excluding a directory\n+   will recursively and irrevocably exclude the entire content).\n    Put a backslash (\"`\\`\") in front of the first \"`!`\" for patterns\n    that begin with a literal \"`!`\", for example, \"`\\!important!.txt`\".\n \n@@ -182,6 +183,19 @@ Another example:\n The second .gitignore prevents Git from ignoring\n `arch/foo/kernel/vmlinux.lds.S`.\n \n+Example to exclude everything except a specific directory `foo/bar`\n+(note the `/*` - without the slash, the wildcard would also exclude\n+everything within `foo/bar`):\n+\n+--------------------------------------------------------------\n+    $ cat .gitignore\n+    # exclude everything except directory foo/bar\n+    /*\n+    !/foo\n+    /foo/*\n+    !/foo/bar\n+--------------------------------------------------------------\n+\n SEE ALSO\n --------\n linkgit:git-rm[1],\n-- \n1.8.4.msysgit.0.12.g88f5ed0\n"},{"id":"230206","messageId":"xmqqeh6s59mm.fsf@gitster.dls.corp.google.com","threadId":"35294","inReplyTo":"527BC037.2000106@gmail.com","subject":"Re: [PATCH 1/2] gitignore.txt: fix documentation of \"**\" patterns","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-11-07T18:50:41Z","receivedAt":"2013-11-07T18:50:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karsten Blees <karsten.blees@gmail.com> writes:\n\n> \"**\" means bold in ASCIIDOC, so we need to escape it.\n>\n> Signed-off-by: Karsten Blees <blees@dcon.de>\n> ---\n>  Documentation/gitignore.txt | 6 +++---\n>  1 file changed, 3 insertions(+), 3 deletions(-)\n>\n> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\n> index 54e334e..f971960 100644\n> --- a/Documentation/gitignore.txt\n> +++ b/Documentation/gitignore.txt\n> @@ -113,12 +113,12 @@ full pathname may have special meaning:\n>  \n>   - A leading \"`**`\" followed by a slash means match in all\n>     directories. For example, \"`**/foo`\" matches file or directory\n> -   \"`foo`\" anywhere, the same as pattern \"`foo`\". \"**/foo/bar\"\n> +   \"`foo`\" anywhere, the same as pattern \"`foo`\". \"`**/foo/bar`\"\n>     matches file or directory \"`bar`\" anywhere that is directly\n>     under directory \"`foo`\".\n>  \n> - - A trailing \"/**\" matches everything inside. For example,\n> -   \"abc/**\" matches all files inside directory \"abc\", relative\n> + - A trailing \"`/**`\" matches everything inside. For example,\n> +   \"`abc/**`\" matches all files inside directory \"`abc`\", relative\n>     to the location of the `.gitignore` file, with infinite depth.\n\nAll, including the quoting of `abc` that does not have anything to\ndo with the double-asterisk, look good; thanks.\n\n>  \n>   - A slash followed by two consecutive asterisks then a slash\n"},{"id":"230208","messageId":"xmqqa9hg59av.fsf@gitster.dls.corp.google.com","threadId":"35294","inReplyTo":"527BC068.3040303@gmail.com","subject":"Re: [PATCH 2/2] gitignore.txt: clarify recursive nature of excluded directories","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-11-07T18:57:44Z","receivedAt":"2013-11-07T18:57:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karsten Blees <karsten.blees@gmail.com> writes:\n\n> Additionally, precedence of negated patterns is exactly as outlined in\n> the DESCRIPTION section, we don't need to repeat this.\n\nVery good, thanks.\n\nEven though I have a suspicion that somebody else may be able to\ncome up with a better phrase that does not sound unnecessarily\nstrongly than \"recursively and irrevocably\", that somebody else is\nnot me, so I'll queue this as-is for now.\n\n>\n> Signed-off-by: Karsten Blees <blees@dcon.de>\n> ---\n>  Documentation/gitignore.txt | 18 ++++++++++++++++--\n>  1 file changed, 16 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\n> index f971960..5ecc48e 100644\n> --- a/Documentation/gitignore.txt\n> +++ b/Documentation/gitignore.txt\n> @@ -79,8 +79,9 @@ PATTERN FORMAT\n>  \n>   - An optional prefix \"`!`\" which negates the pattern; any\n>     matching file excluded by a previous pattern will become\n> -   included again.  If a negated pattern matches, this will\n> -   override lower precedence patterns sources.\n> +   included again. It is not possible to re-include a file if a parent\n> +   directory of that file is excluded (i.e. excluding a directory\n> +   will recursively and irrevocably exclude the entire content).\n>     Put a backslash (\"`\\`\") in front of the first \"`!`\" for patterns\n>     that begin with a literal \"`!`\", for example, \"`\\!important!.txt`\".\n>  \n> @@ -182,6 +183,19 @@ Another example:\n>  The second .gitignore prevents Git from ignoring\n>  `arch/foo/kernel/vmlinux.lds.S`.\n>  \n> +Example to exclude everything except a specific directory `foo/bar`\n> +(note the `/*` - without the slash, the wildcard would also exclude\n> +everything within `foo/bar`):\n> +\n> +--------------------------------------------------------------\n> +    $ cat .gitignore\n> +    # exclude everything except directory foo/bar\n> +    /*\n> +    !/foo\n> +    /foo/*\n> +    !/foo/bar\n> +--------------------------------------------------------------\n> +\n>  SEE ALSO\n>  --------\n>  linkgit:git-rm[1],\n"},{"id":"230209","messageId":"xmqq61s457gd.fsf@gitster.dls.corp.google.com","threadId":"35294","inReplyTo":"xmqqa9hg59av.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 2/2] gitignore.txt: clarify recursive nature of excluded directories","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-11-07T19:37:38Z","receivedAt":"2013-11-07T19:37:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Karsten Blees <karsten.blees@gmail.com> writes:\n>\n>> Additionally, precedence of negated patterns is exactly as outlined in\n>> the DESCRIPTION section, we don't need to repeat this.\n>\n> Very good, thanks.\n>\n> Even though I have a suspicion that somebody else may be able to\n> come up with a better phrase that does not sound unnecessarily\n> strongly than \"recursively and irrevocably\", that somebody else is\n> not me, so I'll queue this as-is for now.\n\nJust in case somebody thinks about rephrasing, to me, these two\nwords sound heavier than the information they actually convey, and\nthat is why I said \"unnecessarily strong\".\n\nThe key thing in the behaviour when a directory is excluded is that\nit tells us to stop going into that directory, and there is no way\nto override it with another .gitignore file somewhere inside,\nbecause we are told not to even bother looking for it.  \"Recursively\nand irrevocably\" may be an accurate description of the end result,\nbut that sounds more like a rule without a \"because\"; to a reader\n(me), it lacks the \"aha, of course\" that comes from understanding\nwhy.\n\n>> Signed-off-by: Karsten Blees <blees@dcon.de>\n>> ---\n>>  Documentation/gitignore.txt | 18 ++++++++++++++++--\n>>  1 file changed, 16 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\n>> index f971960..5ecc48e 100644\n>> --- a/Documentation/gitignore.txt\n>> +++ b/Documentation/gitignore.txt\n>> @@ -79,8 +79,9 @@ PATTERN FORMAT\n>>  \n>>   - An optional prefix \"`!`\" which negates the pattern; any\n>>     matching file excluded by a previous pattern will become\n>> -   included again.  If a negated pattern matches, this will\n>> -   override lower precedence patterns sources.\n>> +   included again. It is not possible to re-include a file if a parent\n>> +   directory of that file is excluded (i.e. excluding a directory\n>> +   will recursively and irrevocably exclude the entire content).\n>>     Put a backslash (\"`\\`\") in front of the first \"`!`\" for patterns\n>>     that begin with a literal \"`!`\", for example, \"`\\!important!.txt`\".\n>>  \n>> @@ -182,6 +183,19 @@ Another example:\n>>  The second .gitignore prevents Git from ignoring\n>>  `arch/foo/kernel/vmlinux.lds.S`.\n>>  \n>> +Example to exclude everything except a specific directory `foo/bar`\n>> +(note the `/*` - without the slash, the wildcard would also exclude\n>> +everything within `foo/bar`):\n>> +\n>> +--------------------------------------------------------------\n>> +    $ cat .gitignore\n>> +    # exclude everything except directory foo/bar\n>> +    /*\n>> +    !/foo\n>> +    /foo/*\n>> +    !/foo/bar\n>> +--------------------------------------------------------------\n>> +\n>>  SEE ALSO\n>>  --------\n>>  linkgit:git-rm[1],\n"},{"id":"230210","messageId":"20131107195546.GA13456@sigill.intra.peff.net","threadId":"35294","inReplyTo":"xmqq61s457gd.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 2/2] gitignore.txt: clarify recursive nature of excluded directories","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-11-07T19:55:46Z","receivedAt":"2013-11-07T19:55:46Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Nov 07, 2013 at 11:37:38AM -0800, Junio C Hamano wrote:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > Karsten Blees <karsten.blees@gmail.com> writes:\n> >\n> >> Additionally, precedence of negated patterns is exactly as outlined in\n> >> the DESCRIPTION section, we don't need to repeat this.\n> >\n> > Very good, thanks.\n> >\n> > Even though I have a suspicion that somebody else may be able to\n> > come up with a better phrase that does not sound unnecessarily\n> > strongly than \"recursively and irrevocably\", that somebody else is\n> > not me, so I'll queue this as-is for now.\n> \n> Just in case somebody thinks about rephrasing, to me, these two\n> words sound heavier than the information they actually convey, and\n> that is why I said \"unnecessarily strong\".\n\nI agree that it seems unnecessarily strong.  The word \"irrevocable\" to\nme implies that it cannot ever be changed. But of course it is only\nirrevocable for the particular run; you can always edit the .gitignore\nfile. :)\n\n> The key thing in the behaviour when a directory is excluded is that\n> it tells us to stop going into that directory, and there is no way\n> to override it with another .gitignore file somewhere inside,\n> because we are told not to even bother looking for it.  \"Recursively\n> and irrevocably\" may be an accurate description of the end result,\n> but that sounds more like a rule without a \"because\"; to a reader\n> (me), it lacks the \"aha, of course\" that comes from understanding\n> why.\n\nI think it is more than just \"we do not descend and so do not read the\n.gitignore file\". I thought the previous discussion on this topic showed\nthat you cannot do:\n\n  $ cat .gitignore\n  foo\n  !foo/bar\n\nto see foo/bar.\n\n> >>   - An optional prefix \"`!`\" which negates the pattern; any\n> >>     matching file excluded by a previous pattern will become\n> >> -   included again.  If a negated pattern matches, this will\n> >> -   override lower precedence patterns sources.\n> >> +   included again. It is not possible to re-include a file if a parent\n> >> +   directory of that file is excluded (i.e. excluding a directory\n> >> +   will recursively and irrevocably exclude the entire content).\n> >>     Put a backslash (\"`\\`\") in front of the first \"`!`\" for patterns\n> >>     that begin with a literal \"`!`\", for example, \"`\\!important!.txt`\".\n\nHow about:\n\n  It is not possible to re-include a file if a parent directory of that\n  file is excluded. Once git considers a directory excluded, it does not\n  descend into the directory to consider its contents further.\n\n> >> +Example to exclude everything except a specific directory `foo/bar`\n> >> +(note the `/*` - without the slash, the wildcard would also exclude\n> >> +everything within `foo/bar`):\n> >> +\n> >> +--------------------------------------------------------------\n> >> +    $ cat .gitignore\n> >> +    # exclude everything except directory foo/bar\n> >> +    /*\n> >> +    !/foo\n> >> +    /foo/*\n> >> +    !/foo/bar\n> >> +--------------------------------------------------------------\n\nThat looks good to me. The simplest example would be handling a\ntop-level directory (i.e., ignore all except `/foo`). That is a subset\nof what's happening above, and I think showing the general case is good.\nI'd worry slightly that a non-astute reader might not figure out how to\nsimplify down to the top-level case, and we should have two examples. I\nmay just be overly pessimistic, though.\n\n-Peff\n"},{"id":"230211","messageId":"527BF7A4.6070203@gmail.com","threadId":"35294","inReplyTo":"20131107195546.GA13456@sigill.intra.peff.net","subject":"Re: [PATCH 2/2] gitignore.txt: clarify recursive nature of excluded directories","fromName":"Karsten Blees","fromEmail":"karsten.blees@gmail.com","sentAt":"2013-11-07T20:27:16Z","receivedAt":"2013-11-07T20:27:16Z","isPatch":true,"sender":{"key":"karsten.blees@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1111200?v=4"},"body":"Am 07.11.2013 20:55, schrieb Jeff King:\n> On Thu, Nov 07, 2013 at 11:37:38AM -0800, Junio C Hamano wrote:\n> \n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>>> Karsten Blees <karsten.blees@gmail.com> writes:\n>>>\n>>>> Additionally, precedence of negated patterns is exactly as outlined in\n>>>> the DESCRIPTION section, we don't need to repeat this.\n>>>\n>>> Very good, thanks.\n>>>\n>>> Even though I have a suspicion that somebody else may be able to\n>>> come up with a better phrase that does not sound unnecessarily\n>>> strongly than \"recursively and irrevocably\", that somebody else is\n>>> not me, so I'll queue this as-is for now.\n>>\n>> Just in case somebody thinks about rephrasing, to me, these two\n>> words sound heavier than the information they actually convey, and\n>> that is why I said \"unnecessarily strong\".\n> \n> I agree that it seems unnecessarily strong.  The word \"irrevocable\" to\n> me implies that it cannot ever be changed. But of course it is only\n> irrevocable for the particular run; you can always edit the .gitignore\n> file. :)\n> \n>> The key thing in the behaviour when a directory is excluded is that\n>> it tells us to stop going into that directory, and there is no way\n>> to override it with another .gitignore file somewhere inside,\n>> because we are told not to even bother looking for it.  \"Recursively\n>> and irrevocably\" may be an accurate description of the end result,\n>> but that sounds more like a rule without a \"because\"; to a reader\n>> (me), it lacks the \"aha, of course\" that comes from understanding\n>> why.\n> \n> I think it is more than just \"we do not descend and so do not read the\n> .gitignore file\". I thought the previous discussion on this topic showed\n> that you cannot do:\n> \n>   $ cat .gitignore\n>   foo\n>   !foo/bar\n> \n> to see foo/bar.\n>\n\nYes, the pattern could be in .git/info/exclude and it still wouldn't work.\n \n>>>>   - An optional prefix \"`!`\" which negates the pattern; any\n>>>>     matching file excluded by a previous pattern will become\n>>>> -   included again.  If a negated pattern matches, this will\n>>>> -   override lower precedence patterns sources.\n>>>> +   included again. It is not possible to re-include a file if a parent\n>>>> +   directory of that file is excluded (i.e. excluding a directory\n>>>> +   will recursively and irrevocably exclude the entire content).\n>>>>     Put a backslash (\"`\\`\") in front of the first \"`!`\" for patterns\n>>>>     that begin with a literal \"`!`\", for example, \"`\\!important!.txt`\".\n> \n> How about:\n> \n>   It is not possible to re-include a file if a parent directory of that\n>   file is excluded. Once git considers a directory excluded, it does not\n>   descend into the directory to consider its contents further.\n> \n\nHmm...an unsuspecting reader might still assume that it works in top-level .gitignore, given the precendence rules above...\n\nHow about this:\n\n   It is not possible to re-include a file if a parent directory of that\n   file is excluded. Git doesn't list excluded directories for performance\n   reasons, so any patterns on contained files have no effect, no matter\n   where they are defined.\n\n>>>> +Example to exclude everything except a specific directory `foo/bar`\n>>>> +(note the `/*` - without the slash, the wildcard would also exclude\n>>>> +everything within `foo/bar`):\n>>>> +\n>>>> +--------------------------------------------------------------\n>>>> +    $ cat .gitignore\n>>>> +    # exclude everything except directory foo/bar\n>>>> +    /*\n>>>> +    !/foo\n>>>> +    /foo/*\n>>>> +    !/foo/bar\n>>>> +--------------------------------------------------------------\n> \n> That looks good to me. The simplest example would be handling a\n> top-level directory (i.e., ignore all except `/foo`). That is a subset\n> of what's happening above, and I think showing the general case is good.\n> I'd worry slightly that a non-astute reader might not figure out how to\n> simplify down to the top-level case, and we should have two examples. I\n> may just be overly pessimistic, though.\n> \n> -Peff\n> \n"},{"id":"230212","messageId":"20131107205732.GA16564@sigill.intra.peff.net","threadId":"35294","inReplyTo":"527BF7A4.6070203@gmail.com","subject":"Re: [PATCH 2/2] gitignore.txt: clarify recursive nature of excluded directories","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-11-07T20:57:32Z","receivedAt":"2013-11-07T20:57:32Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Nov 07, 2013 at 09:27:16PM +0100, Karsten Blees wrote:\n\n> > How about:\n> > \n> >   It is not possible to re-include a file if a parent directory of that\n> >   file is excluded. Once git considers a directory excluded, it does not\n> >   descend into the directory to consider its contents further.\n> > \n> \n> Hmm...an unsuspecting reader might still assume that it works in\n> top-level .gitignore, given the precendence rules above...\n> \n> How about this:\n> \n>    It is not possible to re-include a file if a parent directory of that\n>    file is excluded. Git doesn't list excluded directories for performance\n>    reasons, so any patterns on contained files have no effect, no matter\n>    where they are defined.\n\nYeah, I like that.\n\n-Peff\n"},{"id":"230213","messageId":"527C07DD.9090809@gmail.com","threadId":"35294","inReplyTo":"20131107205732.GA16564@sigill.intra.peff.net","subject":"[PATCH 2/2] gitignore.txt: clarify recursive nature of excluded directories","fromName":"Karsten Blees","fromEmail":"karsten.blees@gmail.com","sentAt":"2013-11-07T21:36:29Z","receivedAt":"2013-11-07T21:36:29Z","isPatch":true,"sender":{"key":"karsten.blees@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1111200?v=4"},"body":"Additionally, precedence of negated patterns is exactly as outlined in\nthe DESCRIPTION section, we don't need to repeat this.\n\nSigned-off-by: Karsten Blees <blees@dcon.de>\n---\n\nI also force-pushed to git://github.com/kblees/git.git kb/gitignore-doc.\n\n Documentation/gitignore.txt | 19 +++++++++++++++++--\n 1 file changed, 17 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\nindex f971960..205e80e 100644\n--- a/Documentation/gitignore.txt\n+++ b/Documentation/gitignore.txt\n@@ -79,8 +79,10 @@ PATTERN FORMAT\n \n  - An optional prefix \"`!`\" which negates the pattern; any\n    matching file excluded by a previous pattern will become\n-   included again.  If a negated pattern matches, this will\n-   override lower precedence patterns sources.\n+   included again. It is not possible to re-include a file if a parent\n+   directory of that file is excluded. Git doesn't list excluded\n+   directories for performance reasons, so any patterns on contained\n+   files have no effect, no matter where they are defined.\n    Put a backslash (\"`\\`\") in front of the first \"`!`\" for patterns\n    that begin with a literal \"`!`\", for example, \"`\\!important!.txt`\".\n \n@@ -182,6 +184,19 @@ Another example:\n The second .gitignore prevents Git from ignoring\n `arch/foo/kernel/vmlinux.lds.S`.\n \n+Example to exclude everything except a specific directory `foo/bar`\n+(note the `/*` - without the slash, the wildcard would also exclude\n+everything within `foo/bar`):\n+\n+--------------------------------------------------------------\n+    $ cat .gitignore\n+    # exclude everything except directory foo/bar\n+    /*\n+    !/foo\n+    /foo/*\n+    !/foo/bar\n+--------------------------------------------------------------\n+\n SEE ALSO\n --------\n linkgit:git-rm[1],\n-- \n1.8.4.msysgit.1\n"},{"id":"230226","messageId":"xmqqbo1vq1dh.fsf@gitster.dls.corp.google.com","threadId":"35294","inReplyTo":"527C07DD.9090809@gmail.com","subject":"Re: [PATCH 2/2] gitignore.txt: clarify recursive nature of excluded directories","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-11-07T22:43:22Z","receivedAt":"2013-11-07T22:43:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks; will queue.\n"}]}