* Missing ? wildcard character in gitignore documentation
@ 2018-01-29 11:29 Jack F
2018-01-29 15:47 ` Randall S. Becker
0 siblings, 1 reply; 6+ messages in thread
From: Jack F @ 2018-01-29 11:29 UTC (permalink / raw)
To: git
Hello,
I have just noticed that the documentation for gitignore is missing
documentation on using the ? to match any single character. I have
included a example below with git version 2.14.1.
|11:05:09 j ~/Development/ls-ignore [master] $ git status On branch
master Your branch is up-to-date with 'origin/master'. nothing to
commit, working tree clean 11:05:11 j ~/Development/ls-ignore [master] $
cat .gitignore *~ node_modules yarn* 11:05:21 j ~/Development/ls-ignore
[master] $ touch test.swo 11:05:31 j ~/Development/ls-ignore [master]?1
$ git status On branch master Your branch is up-to-date with
'origin/master'. Untracked files: (use "git add <file>..." to include in
what will be committed) test.swo nothing added to commit but untracked
files present (use "git add" to track) 11:05:35 j
~/Development/ls-ignore [master]?1 $ echo "*.sw?" >> .gitignore 11:05:40
j ~/Development/ls-ignore [master]≠1 $ cat .gitignore *~ node_modules
yarn* *.sw? 11:05:51 j ~/Development/ls-ignore [master]≠1 $ git status
On branch master Your branch is up-to-date with 'origin/master'. Changes
not staged for commit: (use "git add <file>..." to update what will be
committed) (use "git checkout -- <file>..." to discard changes in
working directory) modified: .gitignore no changes added to commit (use
"git add" and/or "git commit -a")|
Noticed it when checking an npm package (ignore) that uses the
documentation (https://git-scm.com/docs/gitignore) to determine its
functionality. It is documented in
https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files
Cheers.
From,
Jack
https://bytes.nz
https://keybase.io/bytesnz
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Missing ? wildcard character in gitignore documentation
2018-01-29 11:29 Missing ? wildcard character in gitignore documentation Jack F
@ 2018-01-29 15:47 ` Randall S. Becker
2018-01-29 16:07 ` Jack F
2018-01-30 10:13 ` Duy Nguyen
0 siblings, 2 replies; 6+ messages in thread
From: Randall S. Becker @ 2018-01-29 15:47 UTC (permalink / raw)
To: 'Jack F', git
On January 29, 2018 6:30 AM, Jack F wrote:
> I have just noticed that the documentation for gitignore is missing
> documentation on using the ? to match any single character. I have included
> a example below with git version 2.14.1.
>
> |11:05:09 j ~/Development/ls-ignore [master] $ git status On branch
> master Your branch is up-to-date with 'origin/master'. nothing to commit,
> working tree clean 11:05:11 j ~/Development/ls-ignore [master] $ cat
> .gitignore *~ node_modules yarn* 11:05:21 j ~/Development/ls-ignore
> [master] $ touch test.swo 11:05:31 j ~/Development/ls-ignore [master]?1 $
> git status On branch master Your branch is up-to-date with 'origin/master'.
> Untracked files: (use "git add <file>..." to include in what will be committed)
> test.swo nothing added to commit but untracked files present (use "git add"
> to track) 11:05:35 j ~/Development/ls-ignore [master]?1 $ echo "*.sw?" >>
> .gitignore 11:05:40 j ~/Development/ls-ignore [master]≠1 $ cat .gitignore *~
> node_modules
> yarn* *.sw? 11:05:51 j ~/Development/ls-ignore [master]≠1 $ git status On
> branch master Your branch is up-to-date with 'origin/master'. Changes not
> staged for commit: (use "git add <file>..." to update what will be
> committed) (use "git checkout -- <file>..." to discard changes in working
> directory) modified: .gitignore no changes added to commit (use "git add"
> and/or "git commit -a")|
>
>
>
> Noticed it when checking an npm package (ignore) that uses the
> documentation (https://git-scm.com/docs/gitignore) to determine its
> functionality. It is documented in https://git-scm.com/book/en/v2/Git-
> Basics-Recording-Changes-to-the-Repository#Ignoring-Files
The implication of support for ? is there through the following paragraph from the gitignore documentation:
"Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3)
with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the
pathname. For example, "Documentation/*.html" matches "Documentation/git.html"
but not "Documentation/ppc/ppc.html" or "tools/perf/Documentation/perf.html"."
Of course you have to go read fnmatch(3), so it might be good for expand on this here :).
Cheers,
Randall
-- Brief whoami:
NonStop developer since approximately 211288444200000000
UNIX developer since approximately 421664400
-- In my real life, I talk too much.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Missing ? wildcard character in gitignore documentation
2018-01-29 15:47 ` Randall S. Becker
@ 2018-01-29 16:07 ` Jack F
2018-01-30 10:13 ` Duy Nguyen
1 sibling, 0 replies; 6+ messages in thread
From: Jack F @ 2018-01-29 16:07 UTC (permalink / raw)
To: Randall S. Becker, git
Ah. Yes it does. Apologies. Maybe a "See glob(7) for more pattern
matching options, including ! ? [] *"
Thank you very much.
Cheers.
From,
Jack
On 29/01/18 15:47, Randall S. Becker wrote:
> On January 29, 2018 6:30 AM, Jack F wrote:
>> I have just noticed that the documentation for gitignore is missing
>> documentation on using the ? to match any single character. I have included
>> a example below with git version 2.14.1.
>>
>> |11:05:09 j ~/Development/ls-ignore [master] $ git status On branch
>> master Your branch is up-to-date with 'origin/master'. nothing to commit,
>> working tree clean 11:05:11 j ~/Development/ls-ignore [master] $ cat
>> .gitignore *~ node_modules yarn* 11:05:21 j ~/Development/ls-ignore
>> [master] $ touch test.swo 11:05:31 j ~/Development/ls-ignore [master]?1 $
>> git status On branch master Your branch is up-to-date with 'origin/master'.
>> Untracked files: (use "git add <file>..." to include in what will be committed)
>> test.swo nothing added to commit but untracked files present (use "git add"
>> to track) 11:05:35 j ~/Development/ls-ignore [master]?1 $ echo "*.sw?" >>
>> .gitignore 11:05:40 j ~/Development/ls-ignore [master]≠1 $ cat .gitignore *~
>> node_modules
>> yarn* *.sw? 11:05:51 j ~/Development/ls-ignore [master]≠1 $ git status On
>> branch master Your branch is up-to-date with 'origin/master'. Changes not
>> staged for commit: (use "git add <file>..." to update what will be
>> committed) (use "git checkout -- <file>..." to discard changes in working
>> directory) modified: .gitignore no changes added to commit (use "git add"
>> and/or "git commit -a")|
>>
>>
>>
>> Noticed it when checking an npm package (ignore) that uses the
>> documentation (https://git-scm.com/docs/gitignore) to determine its
>> functionality. It is documented in https://git-scm.com/book/en/v2/Git-
>> Basics-Recording-Changes-to-the-Repository#Ignoring-Files
> The implication of support for ? is there through the following paragraph from the gitignore documentation:
>
> "Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3)
> with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the
> pathname. For example, "Documentation/*.html" matches "Documentation/git.html"
> but not "Documentation/ppc/ppc.html" or "tools/perf/Documentation/perf.html"."
>
> Of course you have to go read fnmatch(3), so it might be good for expand on this here :).
>
> Cheers,
> Randall
>
> -- Brief whoami:
> NonStop developer since approximately 211288444200000000
> UNIX developer since approximately 421664400
> -- In my real life, I talk too much.
>
>
>
--
https://bytes.nz
https://keybase.io/bytesnz
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Missing ? wildcard character in gitignore documentation
2018-01-29 15:47 ` Randall S. Becker
2018-01-29 16:07 ` Jack F
@ 2018-01-30 10:13 ` Duy Nguyen
2018-01-30 11:07 ` Ævar Arnfjörð Bjarmason
1 sibling, 1 reply; 6+ messages in thread
From: Duy Nguyen @ 2018-01-30 10:13 UTC (permalink / raw)
To: Randall S. Becker; +Cc: 'Jack F', git
On Mon, Jan 29, 2018 at 10:47:10AM -0500, Randall S. Becker wrote:
> The implication of support for ? is there through the following paragraph from the gitignore documentation:
>
> "Otherwise, Git treats the pattern as a shell glob suitable for
> consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards
> in the pattern will not match a / in the pathname. For example,
> "Documentation/*.html" matches "Documentation/git.html" but not
> "Documentation/ppc/ppc.html" or
> "tools/perf/Documentation/perf.html"."
>
> Of course you have to go read fnmatch(3), so it might be good for
> expand on this here :).
I agree. How about something like this?
-- 8< --
Subject: [PATCH] gitignore.txt: elaborate shell glob syntax
`fnmatch(3)` is a great mention if the intended audience is
programmers. For normal users it's probably better to spell out what
a shell glob is.
This paragraph is updated to roughly tell (or remind) what the main
wildcards are supposed to do. All the details are still hidden away
behind the `fnmatch(3)` wall because bringing the whole specification
here may be too much.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
Documentation/gitignore.txt | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index 63260f0056..0f4b1360bd 100644
--- a/Documentation/gitignore.txt
+++ b/Documentation/gitignore.txt
@@ -102,12 +102,11 @@ PATTERN FORMAT
(relative to the toplevel of the work tree if not from a
`.gitignore` file).
- - Otherwise, Git treats the pattern as a shell glob suitable
- for consumption by fnmatch(3) with the FNM_PATHNAME flag:
- wildcards in the pattern will not match a / in the pathname.
- For example, "Documentation/{asterisk}.html" matches
- "Documentation/git.html" but not "Documentation/ppc/ppc.html"
- or "tools/perf/Documentation/perf.html".
+ - Otherwise, Git treats the pattern as a shell glob: '{asterisk}'
+ matches anything except '/', '?' matches any one character except
+ '/' and '[]' matches one character in a selected range. See
+ fnmatch(3) and the FNM_PATHNAME flag for a more accurate
+ description.
- A leading slash matches the beginning of the pathname.
For example, "/{asterisk}.c" matches "cat-file.c" but not
--
2.16.1.205.g271f633410
-- 8< --
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: Missing ? wildcard character in gitignore documentation
2018-01-30 10:13 ` Duy Nguyen
@ 2018-01-30 11:07 ` Ævar Arnfjörð Bjarmason
2018-01-30 11:32 ` Duy Nguyen
0 siblings, 1 reply; 6+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-01-30 11:07 UTC (permalink / raw)
To: Duy Nguyen; +Cc: Randall S. Becker, 'Jack F', git
On Tue, Jan 30 2018, Duy Nguyen jotted:
> On Mon, Jan 29, 2018 at 10:47:10AM -0500, Randall S. Becker wrote:
>> The implication of support for ? is there through the following paragraph from the gitignore documentation:
>>
>> "Otherwise, Git treats the pattern as a shell glob suitable for
>> consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards
>> in the pattern will not match a / in the pathname. For example,
>> "Documentation/*.html" matches "Documentation/git.html" but not
>> "Documentation/ppc/ppc.html" or
>> "tools/perf/Documentation/perf.html"."
>>
>> Of course you have to go read fnmatch(3), so it might be good for
>> expand on this here :).
>
> I agree. How about something like this?
>
> -- 8< --
> Subject: [PATCH] gitignore.txt: elaborate shell glob syntax
>
> `fnmatch(3)` is a great mention if the intended audience is
> programmers. For normal users it's probably better to spell out what
> a shell glob is.
>
> This paragraph is updated to roughly tell (or remind) what the main
> wildcards are supposed to do. All the details are still hidden away
> behind the `fnmatch(3)` wall because bringing the whole specification
> here may be too much.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> Documentation/gitignore.txt | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
> index 63260f0056..0f4b1360bd 100644
> --- a/Documentation/gitignore.txt
> +++ b/Documentation/gitignore.txt
> @@ -102,12 +102,11 @@ PATTERN FORMAT
> (relative to the toplevel of the work tree if not from a
> `.gitignore` file).
>
> - - Otherwise, Git treats the pattern as a shell glob suitable
> - for consumption by fnmatch(3) with the FNM_PATHNAME flag:
> - wildcards in the pattern will not match a / in the pathname.
> - For example, "Documentation/{asterisk}.html" matches
> - "Documentation/git.html" but not "Documentation/ppc/ppc.html"
> - or "tools/perf/Documentation/perf.html".
> + - Otherwise, Git treats the pattern as a shell glob: '{asterisk}'
> + matches anything except '/', '?' matches any one character except
> + '/' and '[]' matches one character in a selected range. See
> + fnmatch(3) and the FNM_PATHNAME flag for a more accurate
> + description.
>
> - A leading slash matches the beginning of the pathname.
> For example, "/{asterisk}.c" matches "cat-file.c" but not
When reading the docs the other day I was thinking that we should
entirely git rid of these references to fnmatch(3) and write a
gitwildmatch man page.
One of the reasons for why fnmatch() was removed as a supported backend
was because it couldn't be relied on as a backend, so it doesn't make
sense to be referring to that OS-level documentation, wildmatch also has
other features.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Missing ? wildcard character in gitignore documentation
2018-01-30 11:07 ` Ævar Arnfjörð Bjarmason
@ 2018-01-30 11:32 ` Duy Nguyen
0 siblings, 0 replies; 6+ messages in thread
From: Duy Nguyen @ 2018-01-30 11:32 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason
Cc: Randall S. Becker, Jack F, Git Mailing List
On Tue, Jan 30, 2018 at 6:07 PM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
>
> On Tue, Jan 30 2018, Duy Nguyen jotted:
>
>> On Mon, Jan 29, 2018 at 10:47:10AM -0500, Randall S. Becker wrote:
>>> The implication of support for ? is there through the following paragraph from the gitignore documentation:
>>>
>>> "Otherwise, Git treats the pattern as a shell glob suitable for
>>> consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards
>>> in the pattern will not match a / in the pathname. For example,
>>> "Documentation/*.html" matches "Documentation/git.html" but not
>>> "Documentation/ppc/ppc.html" or
>>> "tools/perf/Documentation/perf.html"."
>>>
>>> Of course you have to go read fnmatch(3), so it might be good for
>>> expand on this here :).
>>
>> I agree. How about something like this?
>>
>> -- 8< --
>> Subject: [PATCH] gitignore.txt: elaborate shell glob syntax
>>
>> `fnmatch(3)` is a great mention if the intended audience is
>> programmers. For normal users it's probably better to spell out what
>> a shell glob is.
>>
>> This paragraph is updated to roughly tell (or remind) what the main
>> wildcards are supposed to do. All the details are still hidden away
>> behind the `fnmatch(3)` wall because bringing the whole specification
>> here may be too much.
>>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> ---
>> Documentation/gitignore.txt | 11 +++++------
>> 1 file changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
>> index 63260f0056..0f4b1360bd 100644
>> --- a/Documentation/gitignore.txt
>> +++ b/Documentation/gitignore.txt
>> @@ -102,12 +102,11 @@ PATTERN FORMAT
>> (relative to the toplevel of the work tree if not from a
>> `.gitignore` file).
>>
>> - - Otherwise, Git treats the pattern as a shell glob suitable
>> - for consumption by fnmatch(3) with the FNM_PATHNAME flag:
>> - wildcards in the pattern will not match a / in the pathname.
>> - For example, "Documentation/{asterisk}.html" matches
>> - "Documentation/git.html" but not "Documentation/ppc/ppc.html"
>> - or "tools/perf/Documentation/perf.html".
>> + - Otherwise, Git treats the pattern as a shell glob: '{asterisk}'
>> + matches anything except '/', '?' matches any one character except
>> + '/' and '[]' matches one character in a selected range. See
>> + fnmatch(3) and the FNM_PATHNAME flag for a more accurate
>> + description.
>>
>> - A leading slash matches the beginning of the pathname.
>> For example, "/{asterisk}.c" matches "cat-file.c" but not
>
> When reading the docs the other day I was thinking that we should
> entirely git rid of these references to fnmatch(3) and write a
> gitwildmatch man page.
That's even better :) I forgot that we don't use fnmatch anymore.
> One of the reasons for why fnmatch() was removed as a supported backend
> was because it couldn't be relied on as a backend, so it doesn't make
> sense to be referring to that OS-level documentation, wildmatch also has
> other features.
--
Duy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-01-30 11:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-29 11:29 Missing ? wildcard character in gitignore documentation Jack F
2018-01-29 15:47 ` Randall S. Becker
2018-01-29 16:07 ` Jack F
2018-01-30 10:13 ` Duy Nguyen
2018-01-30 11:07 ` Ævar Arnfjörð Bjarmason
2018-01-30 11:32 ` Duy Nguyen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).