{"thread":{"id":"47711","subject":"Missing ? wildcard character in gitignore documentation","startedAt":"2018-01-29T11:29:49Z","lastAt":"2018-01-30T11:33:20Z","messageCount":6,"participants":["Jack F","Randall S. Becker","Duy Nguyen","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"337656","messageId":"903a193c-0360-59bc-4d86-6470ac8dc1a8@bytes.nz","threadId":"47711","inReplyTo":null,"subject":"Missing ? wildcard character in gitignore documentation","fromName":"Jack F","fromEmail":"jack@bytes.nz","sentAt":"2018-01-29T11:29:36Z","receivedAt":"2018-01-29T11:29:49Z","isPatch":false,"sender":{"key":"jack@bytes.nz","avatar":null},"body":"Hello,\n\nI have just noticed that the documentation for gitignore is missing\ndocumentation on using the ? to match any single character. I have\nincluded a example below with git version 2.14.1.\n\n|11:05:09 j ~/Development/ls-ignore [master] $ git status On branch\nmaster Your branch is up-to-date with 'origin/master'. nothing to\ncommit, working tree clean 11:05:11 j ~/Development/ls-ignore [master] $\ncat .gitignore *~ node_modules yarn* 11:05:21 j ~/Development/ls-ignore\n[master] $ touch test.swo 11:05:31 j ~/Development/ls-ignore [master]?1\n$ git status On branch master Your branch is up-to-date with\n'origin/master'. Untracked files: (use \"git add <file>...\" to include in\nwhat will be committed) test.swo nothing added to commit but untracked\nfiles present (use \"git add\" to track) 11:05:35 j\n~/Development/ls-ignore [master]?1 $ echo \"*.sw?\" >> .gitignore 11:05:40\nj ~/Development/ls-ignore [master]≠1 $ cat .gitignore *~ node_modules\nyarn* *.sw? 11:05:51 j ~/Development/ls-ignore [master]≠1 $ git status\nOn branch master Your branch is up-to-date with 'origin/master'. Changes\nnot staged for commit: (use \"git add <file>...\" to update what will be\ncommitted) (use \"git checkout -- <file>...\" to discard changes in\nworking directory) modified: .gitignore no changes added to commit (use\n\"git add\" and/or \"git commit -a\")|\n\n\n\nNoticed it when checking an npm package (ignore) that uses the\ndocumentation (https://git-scm.com/docs/gitignore) to determine its\nfunctionality. It is documented in\nhttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files\n\nCheers.\n\nFrom,\nJack\n\nhttps://bytes.nz\nhttps://keybase.io/bytesnz\n\n"},{"id":"337663","messageId":"000f01d39918$70009eb0$5001dc10$@nexbridge.com","threadId":"47711","inReplyTo":"903a193c-0360-59bc-4d86-6470ac8dc1a8@bytes.nz","subject":"RE: Missing ? wildcard character in gitignore documentation","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2018-01-29T15:47:10Z","receivedAt":"2018-01-29T15:47:31Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On January 29, 2018 6:30 AM, Jack F wrote:\n> I have just noticed that the documentation for gitignore is missing\n> documentation on using the ? to match any single character. I have included\n> a example below with git version 2.14.1.\n> \n> |11:05:09 j ~/Development/ls-ignore [master] $ git status On branch\n> master Your branch is up-to-date with 'origin/master'. nothing to commit,\n> working tree clean 11:05:11 j ~/Development/ls-ignore [master] $ cat\n> .gitignore *~ node_modules yarn* 11:05:21 j ~/Development/ls-ignore\n> [master] $ touch test.swo 11:05:31 j ~/Development/ls-ignore [master]?1 $\n> git status On branch master Your branch is up-to-date with 'origin/master'.\n> Untracked files: (use \"git add <file>...\" to include in what will be committed)\n> test.swo nothing added to commit but untracked files present (use \"git add\"\n> to track) 11:05:35 j ~/Development/ls-ignore [master]?1 $ echo \"*.sw?\" >>\n> .gitignore 11:05:40 j ~/Development/ls-ignore [master]≠1 $ cat .gitignore *~\n> node_modules\n> yarn* *.sw? 11:05:51 j ~/Development/ls-ignore [master]≠1 $ git status On\n> branch master Your branch is up-to-date with 'origin/master'. Changes not\n> staged for commit: (use \"git add <file>...\" to update what will be\n> committed) (use \"git checkout -- <file>...\" to discard changes in working\n> directory) modified: .gitignore no changes added to commit (use \"git add\"\n> and/or \"git commit -a\")|\n> \n> \n> \n> Noticed it when checking an npm package (ignore) that uses the\n> documentation (https://git-scm.com/docs/gitignore) to determine its\n> functionality. It is documented in https://git-scm.com/book/en/v2/Git-\n> Basics-Recording-Changes-to-the-Repository#Ignoring-Files\n\nThe implication of support for ? is there through the following paragraph from the gitignore documentation:\n\n    \"Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3)\n    with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the\n    pathname. For example, \"Documentation/*.html\" matches \"Documentation/git.html\"\n    but not \"Documentation/ppc/ppc.html\" or \"tools/perf/Documentation/perf.html\".\"\n\nOf course you have to go read fnmatch(3), so it might be good for expand on this here :).\n\nCheers,\nRandall\n\n-- Brief whoami:\n NonStop developer since approximately 211288444200000000\n UNIX developer since approximately 421664400\n-- In my real life, I talk too much.\n\n\n\n"},{"id":"337666","messageId":"6c66708f-cd86-2c54-fc8c-b1260abfadd8@bytes.nz","threadId":"47711","inReplyTo":"000f01d39918$70009eb0$5001dc10$@nexbridge.com","subject":"Re: Missing ? wildcard character in gitignore documentation","fromName":"Jack F","fromEmail":"jack@bytes.nz","sentAt":"2018-01-29T16:07:11Z","receivedAt":"2018-01-29T16:07:24Z","isPatch":false,"sender":{"key":"jack@bytes.nz","avatar":null},"body":"Ah. Yes it does. Apologies. Maybe a \"See glob(7) for more pattern\nmatching options, including ! ? [] *\"\n\nThank you very much.\n\nCheers.\n\nFrom,\nJack\n\nOn 29/01/18 15:47, Randall S. Becker wrote:\n> On January 29, 2018 6:30 AM, Jack F wrote:\n>> I have just noticed that the documentation for gitignore is missing\n>> documentation on using the ? to match any single character. I have included\n>> a example below with git version 2.14.1.\n>>\n>> |11:05:09 j ~/Development/ls-ignore [master] $ git status On branch\n>> master Your branch is up-to-date with 'origin/master'. nothing to commit,\n>> working tree clean 11:05:11 j ~/Development/ls-ignore [master] $ cat\n>> .gitignore *~ node_modules yarn* 11:05:21 j ~/Development/ls-ignore\n>> [master] $ touch test.swo 11:05:31 j ~/Development/ls-ignore [master]?1 $\n>> git status On branch master Your branch is up-to-date with 'origin/master'.\n>> Untracked files: (use \"git add <file>...\" to include in what will be committed)\n>> test.swo nothing added to commit but untracked files present (use \"git add\"\n>> to track) 11:05:35 j ~/Development/ls-ignore [master]?1 $ echo \"*.sw?\" >>\n>> .gitignore 11:05:40 j ~/Development/ls-ignore [master]≠1 $ cat .gitignore *~\n>> node_modules\n>> yarn* *.sw? 11:05:51 j ~/Development/ls-ignore [master]≠1 $ git status On\n>> branch master Your branch is up-to-date with 'origin/master'. Changes not\n>> staged for commit: (use \"git add <file>...\" to update what will be\n>> committed) (use \"git checkout -- <file>...\" to discard changes in working\n>> directory) modified: .gitignore no changes added to commit (use \"git add\"\n>> and/or \"git commit -a\")|\n>>\n>>\n>>\n>> Noticed it when checking an npm package (ignore) that uses the\n>> documentation (https://git-scm.com/docs/gitignore) to determine its\n>> functionality. It is documented in https://git-scm.com/book/en/v2/Git-\n>> Basics-Recording-Changes-to-the-Repository#Ignoring-Files\n> The implication of support for ? is there through the following paragraph from the gitignore documentation:\n>\n>     \"Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3)\n>     with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the\n>     pathname. For example, \"Documentation/*.html\" matches \"Documentation/git.html\"\n>     but not \"Documentation/ppc/ppc.html\" or \"tools/perf/Documentation/perf.html\".\"\n>\n> Of course you have to go read fnmatch(3), so it might be good for expand on this here :).\n>\n> Cheers,\n> Randall\n>\n> -- Brief whoami:\n>  NonStop developer since approximately 211288444200000000\n>  UNIX developer since approximately 421664400\n> -- In my real life, I talk too much.\n>\n>\n>\n\n-- \nhttps://bytes.nz\nhttps://keybase.io/bytesnz\n\n\n"},{"id":"337778","messageId":"20180130101351.GA761@ash","threadId":"47711","inReplyTo":"000f01d39918$70009eb0$5001dc10$@nexbridge.com","subject":"Re: Missing ? wildcard character in gitignore documentation","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-01-30T10:13:52Z","receivedAt":"2018-01-30T10:14:05Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Mon, Jan 29, 2018 at 10:47:10AM -0500, Randall S. Becker wrote:\n> The implication of support for ? is there through the following paragraph from the gitignore documentation:\n> \n>     \"Otherwise, Git treats the pattern as a shell glob suitable for\n>     consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards\n>     in the pattern will not match a / in the pathname. For example,\n>     \"Documentation/*.html\" matches \"Documentation/git.html\" but not\n>     \"Documentation/ppc/ppc.html\" or\n>     \"tools/perf/Documentation/perf.html\".\"\n> \n> Of course you have to go read fnmatch(3), so it might be good for\n> expand on this here :).\n\nI agree. How about something like this?\n\n-- 8< --\nSubject: [PATCH] gitignore.txt: elaborate shell glob syntax\n\n`fnmatch(3)` is a great mention if the intended audience is\nprogrammers. For normal users it's probably better to spell out what\na shell glob is.\n\nThis paragraph is updated to roughly tell (or remind) what the main\nwildcards are supposed to do. All the details are still hidden away\nbehind the `fnmatch(3)` wall because bringing the whole specification\nhere may be too much.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Documentation/gitignore.txt | 11 +++++------\n 1 file changed, 5 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\nindex 63260f0056..0f4b1360bd 100644\n--- a/Documentation/gitignore.txt\n+++ b/Documentation/gitignore.txt\n@@ -102,12 +102,11 @@ PATTERN FORMAT\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 suitable\n-   for consumption by fnmatch(3) with the FNM_PATHNAME flag:\n-   wildcards in the pattern will not match a / in the pathname.\n-   For example, \"Documentation/{asterisk}.html\" matches\n-   \"Documentation/git.html\" but not \"Documentation/ppc/ppc.html\"\n-   or \"tools/perf/Documentation/perf.html\".\n+ - Otherwise, Git treats the pattern as a shell glob: '{asterisk}'\n+   matches 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 accurate\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-- \n2.16.1.205.g271f633410\n\n-- 8< --\n"},{"id":"337781","messageId":"871si7ob9z.fsf@evledraar.gmail.com","threadId":"47711","inReplyTo":"20180130101351.GA761@ash","subject":"Re: Missing ? wildcard character in gitignore documentation","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-01-30T11:07:20Z","receivedAt":"2018-01-30T11:07:31Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Jan 30 2018, Duy Nguyen jotted:\n\n> On Mon, Jan 29, 2018 at 10:47:10AM -0500, Randall S. Becker wrote:\n>> The implication of support for ? is there through the following paragraph from the gitignore documentation:\n>>\n>>     \"Otherwise, Git treats the pattern as a shell glob suitable for\n>>     consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards\n>>     in the pattern will not match a / in the pathname. For example,\n>>     \"Documentation/*.html\" matches \"Documentation/git.html\" but not\n>>     \"Documentation/ppc/ppc.html\" or\n>>     \"tools/perf/Documentation/perf.html\".\"\n>>\n>> Of course you have to go read fnmatch(3), so it might be good for\n>> expand on this here :).\n>\n> I agree. How about something like this?\n>\n> -- 8< --\n> Subject: [PATCH] gitignore.txt: elaborate shell glob syntax\n>\n> `fnmatch(3)` is a great mention if the intended audience is\n> programmers. For normal users it's probably better to spell out what\n> a shell glob is.\n>\n> This paragraph is updated to roughly tell (or remind) what the main\n> wildcards are supposed to do. All the details are still hidden away\n> behind the `fnmatch(3)` wall because bringing the whole specification\n> here may be too much.\n>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  Documentation/gitignore.txt | 11 +++++------\n>  1 file changed, 5 insertions(+), 6 deletions(-)\n>\n> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\n> index 63260f0056..0f4b1360bd 100644\n> --- a/Documentation/gitignore.txt\n> +++ b/Documentation/gitignore.txt\n> @@ -102,12 +102,11 @@ PATTERN FORMAT\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 suitable\n> -   for consumption by fnmatch(3) with the FNM_PATHNAME flag:\n> -   wildcards in the pattern will not match a / in the pathname.\n> -   For example, \"Documentation/{asterisk}.html\" matches\n> -   \"Documentation/git.html\" but not \"Documentation/ppc/ppc.html\"\n> -   or \"tools/perf/Documentation/perf.html\".\n> + - Otherwise, Git treats the pattern as a shell glob: '{asterisk}'\n> +   matches 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 accurate\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\nWhen reading the docs the other day I was thinking that we should\nentirely git rid of these references to fnmatch(3) and write a\ngitwildmatch man page.\n\nOne of the reasons for why fnmatch() was removed as a supported backend\nwas because it couldn't be relied on as a backend, so it doesn't make\nsense to be referring to that OS-level documentation, wildmatch also has\nother features.\n"},{"id":"337784","messageId":"CACsJy8BOnRrP4qXvsFcLBGukL=JzDbrA3kju87_ND3u36g=RsQ@mail.gmail.com","threadId":"47711","inReplyTo":"871si7ob9z.fsf@evledraar.gmail.com","subject":"Re: Missing ? wildcard character in gitignore documentation","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-01-30T11:32:45Z","receivedAt":"2018-01-30T11:33:20Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Jan 30, 2018 at 6:07 PM, Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> On Tue, Jan 30 2018, Duy Nguyen jotted:\n>\n>> On Mon, Jan 29, 2018 at 10:47:10AM -0500, Randall S. Becker wrote:\n>>> The implication of support for ? is there through the following paragraph from the gitignore documentation:\n>>>\n>>>     \"Otherwise, Git treats the pattern as a shell glob suitable for\n>>>     consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards\n>>>     in the pattern will not match a / in the pathname. For example,\n>>>     \"Documentation/*.html\" matches \"Documentation/git.html\" but not\n>>>     \"Documentation/ppc/ppc.html\" or\n>>>     \"tools/perf/Documentation/perf.html\".\"\n>>>\n>>> Of course you have to go read fnmatch(3), so it might be good for\n>>> expand on this here :).\n>>\n>> I agree. How about something like this?\n>>\n>> -- 8< --\n>> Subject: [PATCH] gitignore.txt: elaborate shell glob syntax\n>>\n>> `fnmatch(3)` is a great mention if the intended audience is\n>> programmers. For normal users it's probably better to spell out what\n>> a shell glob is.\n>>\n>> This paragraph is updated to roughly tell (or remind) what the main\n>> wildcards are supposed to do. All the details are still hidden away\n>> behind the `fnmatch(3)` wall because bringing the whole specification\n>> here may be too much.\n>>\n>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n>> ---\n>>  Documentation/gitignore.txt | 11 +++++------\n>>  1 file changed, 5 insertions(+), 6 deletions(-)\n>>\n>> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\n>> index 63260f0056..0f4b1360bd 100644\n>> --- a/Documentation/gitignore.txt\n>> +++ b/Documentation/gitignore.txt\n>> @@ -102,12 +102,11 @@ PATTERN FORMAT\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 suitable\n>> -   for consumption by fnmatch(3) with the FNM_PATHNAME flag:\n>> -   wildcards in the pattern will not match a / in the pathname.\n>> -   For example, \"Documentation/{asterisk}.html\" matches\n>> -   \"Documentation/git.html\" but not \"Documentation/ppc/ppc.html\"\n>> -   or \"tools/perf/Documentation/perf.html\".\n>> + - Otherwise, Git treats the pattern as a shell glob: '{asterisk}'\n>> +   matches 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 accurate\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>\n> When reading the docs the other day I was thinking that we should\n> entirely git rid of these references to fnmatch(3) and write a\n> gitwildmatch man page.\n\nThat's even better :) I forgot that we don't use fnmatch anymore.\n\n> One of the reasons for why fnmatch() was removed as a supported backend\n> was because it couldn't be relied on as a backend, so it doesn't make\n> sense to be referring to that OS-level documentation, wildmatch also has\n> other features.\n\n\n\n-- \nDuy\n"}]}