{"thread":{"id":"51239","subject":"[PATCH] make slash-rules more readable","startedAt":"2019-06-04T17:34:54Z","lastAt":"2019-07-04T10:46:42Z","messageCount":7,"participants":["Dr. Adam Nielsen","Philip Oakley","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"376678","messageId":"20190604173446.2664-1-admin@in-ici.net","threadId":"51239","inReplyTo":null,"subject":"[PATCH] make slash-rules more readable","fromName":"Dr. Adam Nielsen","fromEmail":"admin@in-ici.net","sentAt":"2019-06-04T17:34:46Z","receivedAt":"2019-06-04T17:34:54Z","isPatch":true,"sender":{"key":"admin@in-ici.net","avatar":"https://avatars.githubusercontent.com/u/1765602?v=4"},"body":"gitignore.txt: make slash-rules more readable\n\nRenew paragraphs relevant for pattern with slash. \nAim to make it more clear and to avoid possible\npitfalls for the reader. Add some examples.\n\nSigned-off-by: Dr. Adam Nielsen <admin@in-ici.net>\n\n---\n Documentation/gitignore.txt | 66 ++++++++++++++++++++++++-------------\n 1 file changed, 44 insertions(+), 22 deletions(-)\n\ndiff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\nindex b5bc9dbff0..d47b1ae296 100644\n--- a/Documentation/gitignore.txt\n+++ b/Documentation/gitignore.txt\n@@ -89,28 +89,28 @@ PATTERN FORMAT\n    Put a backslash (\"`\\`\") in front of the first \"`!`\" for patterns\n    that begin with a literal \"`!`\", for example, \"`\\!important!.txt`\".\n \n- - If the pattern ends with a slash, it is removed for the\n-   purpose of the following description, but it would only find\n-   a match with a directory.  In other words, `foo/` will match a\n-   directory `foo` and paths underneath it, but will not match a\n-   regular file or a symbolic link `foo` (this is consistent\n-   with the way how pathspec works in general in Git).\n-\n- - If the pattern does not contain a slash '/', Git treats it as\n-   a shell glob pattern and checks for a match against the\n-   pathname relative to the location of the `.gitignore` file\n-   (relative to the toplevel of the work tree if not from a\n-   `.gitignore` file).\n-\n- - Otherwise, Git treats the pattern as a shell glob: \"`*`\" matches\n-   anything except \"`/`\", \"`?`\" matches any one character except \"`/`\"\n-   and \"`[]`\" matches one character in a selected range. See\n-   fnmatch(3) and the FNM_PATHNAME flag for a more detailed\n-   description.\n-\n- - A leading slash matches the beginning of the pathname.\n-   For example, \"/{asterisk}.c\" matches \"cat-file.c\" but not\n-   \"mozilla-sha1/sha1.c\".\n+ - The slash '/' is used as the directory separator. Separators may\n+   occur at the beginning, middle or end of the `.gitignore` search pattern.\n+\n+ - If there is a separator at the beginning or middle (or both) of the\n+   pattern, then the pattern is relative to the directory level of the\n+   particular `.gitignore` file itself. Otherwise the pattern may also\n+   match at any level below the `.gitignore` level.\n+\n+ - If there is a separator at the end of the pattern then the pattern\n+   will only match directories, otherwise the pattern can match both\n+   files and directories.\n+\n+ - For example, a pattern `doc/frotz/` matches `doc/frotz` directory,\n+   but not `a/doc/frotz` directory; however `frotz/` matches `frotz`\n+   and `a/frotz` that is a directory (all paths are relative from\n+   the `.gitignore` file).\n+\n+ - An asterisk \"`*`\" matches anything except a slash.\n+   The character \"`?`\" matches any one character except \"`/`\".\n+   The range notation, e.g. `[a-zA-Z]`, can be used to match\n+   one of the characters in a range. See fnmatch(3) and the\n+   FNM_PATHNAME flag for a more detailed description.\n \n Two consecutive asterisks (\"`**`\") in patterns matched against\n full pathname may have special meaning:\n@@ -152,6 +152,28 @@ To stop tracking a file that is currently tracked, use\n EXAMPLES\n --------\n \n+ - The pattern `hello.*` matches any file or folder\n+   whose name begins with `hello`. If one wants to restrict\n+   this only to the directory and not in its subdirectories,\n+   one can prepend the pattern with a slash, i.e. `/hello.*`;\n+   the pattern now matches `hello.txt`, `hello.c` but not\n+   `a/hello.java`.\n+\n+ - The pattern `foo/` will match a directory `foo` and\n+   paths underneath it, but will not match a regular file\n+   or a symbolic link `foo` (this is consistent with the\n+   way how pathspec works in general in Git)\n+\n+ - The pattern `doc/frotz` and `/doc/frotz` have the same effect\n+   in any `.gitignore` file. In other words, a leading slash\n+   is not relevant  if there is already a middle slash in\n+   the pattern.\n+\n+ - The pattern \"foo/*\", matches \"foo/test.json\"\n+   (a regular file), \"foo/bar\" (a directory), but it does not match\n+   \"foo/bar/hello.c\" (a regular file), as the asterisk in the\n+   pattern does not match \"bar/hello.c\" which has a slash in it.\n+\n --------------------------------------------------------------\n     $ git status\n     [...]\n-- \n2.17.1\n\n"},{"id":"377966","messageId":"bd722415-1547-8db5-f88a-c35c8b48d8be@in-ici.net","threadId":"51239","inReplyTo":"20190604173446.2664-1-admin@in-ici.net","subject":"Re: [PATCH] make slash-rules more readable","fromName":"Dr. Adam Nielsen","fromEmail":"admin@in-ici.net","sentAt":"2019-06-25T11:05:13Z","receivedAt":"2019-06-25T11:05:16Z","isPatch":true,"sender":{"key":"admin@in-ici.net","avatar":"https://avatars.githubusercontent.com/u/1765602?v=4"},"body":"Hi everyone,\n\nany comments about the patch note from 04.06 ?\n\nAll the best,\nAdam\n\nOn 04.06.19 19:34, Dr. Adam Nielsen wrote:\n> gitignore.txt: make slash-rules more readable\n> \n> Renew paragraphs relevant for pattern with slash.\n> Aim to make it more clear and to avoid possible\n> pitfalls for the reader. Add some examples.\n> \n> Signed-off-by: Dr. Adam Nielsen <admin@in-ici.net>\n> \n> ---\n>   Documentation/gitignore.txt | 66 ++++++++++++++++++++++++-------------\n>   1 file changed, 44 insertions(+), 22 deletions(-)\n> \n> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\n> index b5bc9dbff0..d47b1ae296 100644\n> --- a/Documentation/gitignore.txt\n> +++ b/Documentation/gitignore.txt\n> @@ -89,28 +89,28 @@ PATTERN FORMAT\n>      Put a backslash (\"`\\`\") in front of the first \"`!`\" for patterns\n>      that begin with a literal \"`!`\", for example, \"`\\!important!.txt`\".\n>   \n> - - If the pattern ends with a slash, it is removed for the\n> -   purpose of the following description, but it would only find\n> -   a match with a directory.  In other words, `foo/` will match a\n> -   directory `foo` and paths underneath it, but will not match a\n> -   regular file or a symbolic link `foo` (this is consistent\n> -   with the way how pathspec works in general in Git).\n> -\n> - - If the pattern does not contain a slash '/', Git treats it as\n> -   a shell glob pattern and checks for a match against the\n> -   pathname relative to the location of the `.gitignore` file\n> -   (relative to the toplevel of the work tree if not from a\n> -   `.gitignore` file).\n> -\n> - - Otherwise, Git treats the pattern as a shell glob: \"`*`\" matches\n> -   anything except \"`/`\", \"`?`\" matches any one character except \"`/`\"\n> -   and \"`[]`\" matches one character in a selected range. See\n> -   fnmatch(3) and the FNM_PATHNAME flag for a more detailed\n> -   description.\n> -\n> - - A leading slash matches the beginning of the pathname.\n> -   For example, \"/{asterisk}.c\" matches \"cat-file.c\" but not\n> -   \"mozilla-sha1/sha1.c\".\n> + - The slash '/' is used as the directory separator. Separators may\n> +   occur at the beginning, middle or end of the `.gitignore` search pattern.\n> +\n> + - If there is a separator at the beginning or middle (or both) of the\n> +   pattern, then the pattern is relative to the directory level of the\n> +   particular `.gitignore` file itself. Otherwise the pattern may also\n> +   match at any level below the `.gitignore` level.\n> +\n> + - If there is a separator at the end of the pattern then the pattern\n> +   will only match directories, otherwise the pattern can match both\n> +   files and directories.\n> +\n> + - For example, a pattern `doc/frotz/` matches `doc/frotz` directory,\n> +   but not `a/doc/frotz` directory; however `frotz/` matches `frotz`\n> +   and `a/frotz` that is a directory (all paths are relative from\n> +   the `.gitignore` file).\n> +\n> + - An asterisk \"`*`\" matches anything except a slash.\n> +   The character \"`?`\" matches any one character except \"`/`\".\n> +   The range notation, e.g. `[a-zA-Z]`, can be used to match\n> +   one of the characters in a range. See fnmatch(3) and the\n> +   FNM_PATHNAME flag for a more detailed description.\n>   \n>   Two consecutive asterisks (\"`**`\") in patterns matched against\n>   full pathname may have special meaning:\n> @@ -152,6 +152,28 @@ To stop tracking a file that is currently tracked, use\n>   EXAMPLES\n>   --------\n>   \n> + - The pattern `hello.*` matches any file or folder\n> +   whose name begins with `hello`. If one wants to restrict\n> +   this only to the directory and not in its subdirectories,\n> +   one can prepend the pattern with a slash, i.e. `/hello.*`;\n> +   the pattern now matches `hello.txt`, `hello.c` but not\n> +   `a/hello.java`.\n> +\n> + - The pattern `foo/` will match a directory `foo` and\n> +   paths underneath it, but will not match a regular file\n> +   or a symbolic link `foo` (this is consistent with the\n> +   way how pathspec works in general in Git)\n> +\n> + - The pattern `doc/frotz` and `/doc/frotz` have the same effect\n> +   in any `.gitignore` file. In other words, a leading slash\n> +   is not relevant  if there is already a middle slash in\n> +   the pattern.\n> +\n> + - The pattern \"foo/*\", matches \"foo/test.json\"\n> +   (a regular file), \"foo/bar\" (a directory), but it does not match\n> +   \"foo/bar/hello.c\" (a regular file), as the asterisk in the\n> +   pattern does not match \"bar/hello.c\" which has a slash in it.\n> +\n>   --------------------------------------------------------------\n>       $ git status\n>       [...]\n> \n\n-- \nphotograph \t\n*Dr. Adam Nielsen\n* Administrator | IN/ICI/WHO\n*IN:* \tnlp-institutes.net <https://nlp-institutes.net>\n*ICI:* \tcoaching-institutes.net <https://coaching-institutes.net>\n*WHO:* \tworld-hypnosis.org <https://world-hypnosis.org>\n\n"},{"id":"377971","messageId":"13f99ce6-f856-6554-5c14-1b1838d697d0@iee.org","threadId":"51239","inReplyTo":"bd722415-1547-8db5-f88a-c35c8b48d8be@in-ici.net","subject":"Re: [PATCH] make slash-rules more readable","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-06-25T11:31:41Z","receivedAt":"2019-06-25T11:31:46Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"only one minor point...\n\nOn 25/06/2019 12:05, Dr. Adam Nielsen wrote:\n> Hi everyone,\n>\n> any comments about the patch note from 04.06 ?\n>\n> All the best,\n> Adam\n>\n> On 04.06.19 19:34, Dr. Adam Nielsen wrote:\n>> gitignore.txt: make slash-rules more readable\n>>\n>> Renew paragraphs relevant for pattern with slash.\n>> Aim to make it more clear and to avoid possible\n>> pitfalls for the reader. Add some examples.\n>>\n>> Signed-off-by: Dr. Adam Nielsen <admin@in-ici.net>\n>>\n>> ---\n>>   Documentation/gitignore.txt | 66 ++++++++++++++++++++++++-------------\n>>   1 file changed, 44 insertions(+), 22 deletions(-)\n>>\n>> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\n>> index b5bc9dbff0..d47b1ae296 100644\n>> --- a/Documentation/gitignore.txt\n>> +++ b/Documentation/gitignore.txt\n>> @@ -89,28 +89,28 @@ PATTERN FORMAT\n>>      Put a backslash (\"`\\`\") in front of the first \"`!`\" for patterns\n>>      that begin with a literal \"`!`\", for example, \"`\\!important!.txt`\".\n>>   - - If the pattern ends with a slash, it is removed for the\n>> -   purpose of the following description, but it would only find\n>> -   a match with a directory.  In other words, `foo/` will match a\n>> -   directory `foo` and paths underneath it, but will not match a\n>> -   regular file or a symbolic link `foo` (this is consistent\n>> -   with the way how pathspec works in general in Git).\n>> -\n>> - - If the pattern does not contain a slash '/', Git treats it as\n>> -   a shell glob pattern and checks for a match against the\n>> -   pathname relative to the location of the `.gitignore` file\n>> -   (relative to the toplevel of the work tree if not from a\n>> -   `.gitignore` file).\n>> -\n>> - - Otherwise, Git treats the pattern as a shell glob: \"`*`\" matches\n>> -   anything except \"`/`\", \"`?`\" matches any one character except \"`/`\"\n>> -   and \"`[]`\" matches one character in a selected range. See\n>> -   fnmatch(3) and the FNM_PATHNAME flag for a more detailed\n>> -   description.\n>> -\n>> - - A leading slash matches the beginning of the pathname.\n>> -   For example, \"/{asterisk}.c\" matches \"cat-file.c\" but not\n>> -   \"mozilla-sha1/sha1.c\".\n>> + - The slash '/' is used as the directory separator. Separators may\n>> +   occur at the beginning, middle or end of the `.gitignore` search \n>> pattern.\n>> +\n>> + - If there is a separator at the beginning or middle (or both) of the\n>> +   pattern, then the pattern is relative to the directory level of the\n>> +   particular `.gitignore` file itself. Otherwise the pattern may also\n>> +   match at any level below the `.gitignore` level.\n>> +\n>> + - If there is a separator at the end of the pattern then the pattern\n>> +   will only match directories, otherwise the pattern can match both\n>> +   files and directories.\n>> +\n>> + - For example, a pattern `doc/frotz/` matches `doc/frotz` directory,\n>> +   but not `a/doc/frotz` directory; however `frotz/` matches `frotz`\n\nher I misread this as:  \"but not a `doc/frotz` directory;\"\ni.e. the leading 'a' is too easy to skim over as is part of the \nsentence's prose, so maybe change to a 'baz' lead directory (bar already \nhaving been used below).\n\n>> +   and `a/frotz` that is a directory (all paths are relative from\n>> +   the `.gitignore` file).\n>> +\n>> + - An asterisk \"`*`\" matches anything except a slash.\n>> +   The character \"`?`\" matches any one character except \"`/`\".\n>> +   The range notation, e.g. `[a-zA-Z]`, can be used to match\n>> +   one of the characters in a range. See fnmatch(3) and the\n>> +   FNM_PATHNAME flag for a more detailed description.\n>>     Two consecutive asterisks (\"`**`\") in patterns matched against\n>>   full pathname may have special meaning:\n>> @@ -152,6 +152,28 @@ To stop tracking a file that is currently \n>> tracked, use\n>>   EXAMPLES\n>>   --------\n>>   + - The pattern `hello.*` matches any file or folder\n>> +   whose name begins with `hello`. If one wants to restrict\n>> +   this only to the directory and not in its subdirectories,\n>> +   one can prepend the pattern with a slash, i.e. `/hello.*`;\n>> +   the pattern now matches `hello.txt`, `hello.c` but not\n>> +   `a/hello.java`.\n>> +\n>> + - The pattern `foo/` will match a directory `foo` and\n>> +   paths underneath it, but will not match a regular file\n>> +   or a symbolic link `foo` (this is consistent with the\n>> +   way how pathspec works in general in Git)\n>> +\n>> + - The pattern `doc/frotz` and `/doc/frotz` have the same effect\n>> +   in any `.gitignore` file. In other words, a leading slash\n>> +   is not relevant  if there is already a middle slash in\n>> +   the pattern.\n>> +\n>> + - The pattern \"foo/*\", matches \"foo/test.json\"\n>> +   (a regular file), \"foo/bar\" (a directory), but it does not match\n>> +   \"foo/bar/hello.c\" (a regular file), as the asterisk in the\n>> +   pattern does not match \"bar/hello.c\" which has a slash in it.\n>> +\n>>   --------------------------------------------------------------\n>>       $ git status\n>>       [...]\n>>\n>\nHave you tried it out on any StackOverflow replies to see if those that \ninhabit that zone find it helpful?\nPhilip\n"},{"id":"378172","messageId":"d1d2ebec-a94a-0092-4a6d-8ae32db1573b@in-ici.net","threadId":"51239","inReplyTo":"13f99ce6-f856-6554-5c14-1b1838d697d0@iee.org","subject":"Re: [PATCH] make slash-rules more readable","fromName":"Dr. Adam Nielsen","fromEmail":"admin@in-ici.net","sentAt":"2019-06-27T17:10:38Z","receivedAt":"2019-06-27T17:10:41Z","isPatch":true,"sender":{"key":"admin@in-ici.net","avatar":"https://avatars.githubusercontent.com/u/1765602?v=4"},"body":"\nOn 25.06.19 13:31, Philip Oakley wrote:\n> only one minor point...\n\n >>> + - For example, a pattern `doc/frotz/` matches `doc/frotz` directory,\n >>> +   but not `a/doc/frotz` directory; however `frotz/` matches `frotz`\n >\n > her I misread this as:  \"but not a `doc/frotz` directory;\"\n > i.e. the leading 'a' is too easy to skim over as is part of the\n > sentence's prose, so maybe change to a 'baz' lead directory (bar already\n > having been used below).\n\nYes we could change that.\n\n> Have you tried it out on any StackOverflow replies to see if those that \n> inhabit that zone find it helpful?\n> Philip\nI answered one person who had a hard time reading the docs at SO, but he \ndidn't respond and the last time he was online was 2018, so I didn't \nmade the effort to edit my answer with the current version.\n\n-\n\nWhat are the next steps? If there are no more responses, does it imply \nthat everyone agrees with this patch? Can we publish it online?\n\n"},{"id":"378179","messageId":"xmqqd0iyc4av.fsf@gitster-ct.c.googlers.com","threadId":"51239","inReplyTo":"bd722415-1547-8db5-f88a-c35c8b48d8be@in-ici.net","subject":"Re: [PATCH] make slash-rules more readable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-06-27T17:43:20Z","receivedAt":"2019-06-27T17:43:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Dr. Adam Nielsen\" <admin@in-ici.net> writes:\n\n> Hi everyone,\n>\n> any comments about the patch note from 04.06 ?\n\nhttps://git.kernel.org/pub/scm/git/git.git/log/ shows that the topic\nholding the patch has already been merged to the 'master' branch\nabout 6 days ago, at\n\nhttps://git.kernel.org/pub/scm/git/git.git/commit/?id=e694ea5e04ea2cabc64ade337063b5562810b268\n\nThanks.\n"},{"id":"378596","messageId":"b33e42c2-96a7-88d8-03b1-2da317dfa692@iee.org","threadId":"51239","inReplyTo":"d1d2ebec-a94a-0092-4a6d-8ae32db1573b@in-ici.net","subject":"Re: [PATCH] make slash-rules more readable","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-07-04T10:40:33Z","receivedAt":"2019-07-04T10:40:34Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 27/06/2019 18:10, Dr. Adam Nielsen wrote:\n>\n> On 25.06.19 13:31, Philip Oakley wrote:\n>> only one minor point...\n>\n> >>> + - For example, a pattern `doc/frotz/` matches `doc/frotz` \n> directory,\n> >>> +   but not `a/doc/frotz` directory; however `frotz/` matches `frotz`\n> >\n> > her I misread this as:  \"but not a `doc/frotz` directory;\"\n> > i.e. the leading 'a' is too easy to skim over as is part of the\n> > sentence's prose, so maybe change to a 'baz' lead directory (bar \n> already\n> > having been used below).\n>\n> Yes we could change that.\n>\n>> Have you tried it out on any StackOverflow replies to see if those \n>> that inhabit that zone find it helpful?\n>> Philip\n> I answered one person who had a hard time reading the docs at SO, but \n> he didn't respond and the last time he was online was 2018, so I \n> didn't made the effort to edit my answer with the current version.\n>\n> -\n>\n> What are the next steps? If there are no more responses, does it imply \n> that everyone agrees with this patch? Can we publish it online?\n>\nIf all the issues are cleared then I believe it is a case of providing a \nclean reroll (maybe identical to previous..) to Junio and the list to \nconfirm that all issues have been resolved and it is ready for \npu->next->master in the normal way, which should then show up in his \n'What's cooking' emails.\n"},{"id":"378597","messageId":"1104adb4-dd84-9e87-3c95-70a0088eadb0@iee.org","threadId":"51239","inReplyTo":"b33e42c2-96a7-88d8-03b1-2da317dfa692@iee.org","subject":"Re: [PATCH] make slash-rules more readable","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-07-04T10:46:41Z","receivedAt":"2019-07-04T10:46:42Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Oops, I missed Junio's message [1] while looking through my backlog. \nSorry for the noise.\nPhilip\n\nOn 04/07/2019 11:40, Philip Oakley wrote:\n> If all the issues are cleared then I believe it is a case of providing \n> a clean reroll (maybe identical to previous..) to Junio and the list \n> to confirm that all issues have been resolved and it is ready for \n> pu->next->master in the normal way, which should then show up in his \n> 'What's cooking' emails. \n[1] <xmqqd0iyc4av.fsf@gitster-ct.c.googlers.com>\n"}]}