From: Duy Nguyen <pclouds@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: "Randall S. Becker" <rsbecker@nexbridge.com>,
Jack F <jack@bytes.nz>, Git Mailing List <git@vger.kernel.org>
Subject: Re: Missing ? wildcard character in gitignore documentation
Date: Tue, 30 Jan 2018 18:32:45 +0700 [thread overview]
Message-ID: <CACsJy8BOnRrP4qXvsFcLBGukL=JzDbrA3kju87_ND3u36g=RsQ@mail.gmail.com> (raw)
In-Reply-To: <871si7ob9z.fsf@evledraar.gmail.com>
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
prev parent reply other threads:[~2018-01-30 11:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACsJy8BOnRrP4qXvsFcLBGukL=JzDbrA3kju87_ND3u36g=RsQ@mail.gmail.com' \
--to=pclouds@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=jack@bytes.nz \
--cc=rsbecker@nexbridge.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).