From: Junio C Hamano <gitster@pobox.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC] The design of new pathspec features
Date: Tue, 29 Jan 2013 08:27:05 -0800 [thread overview]
Message-ID: <7vd2worm3q.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7vk3qwrmea.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Tue, 29 Jan 2013 08:20:45 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> Duy Nguyen <pclouds@gmail.com> writes:
>
>> On Tue, Jan 29, 2013 at 11:35 AM, Duy Nguyen <pclouds@gmail.com> wrote:
>>> :(glob) magic
>>> =============
>>>
>>> This magic is for people who want globbing. However, it does _not_ use
>>> the same matching mechanism the non-magic pathspec does today. It uses
>>> wildmatch(WM_PATHNAME), which basically means '*' does not match
>>> slashes and "**" does.
>>>
>>> Global option --glob-pathspecs is added to add :(glob) to all
>>> pathspec. :(literal) magic overrides this global option.
>>
>> I forgot one thing. The current pathspec behavior, the pattern "[a-z]"
>> would match a file named "[a-z]" (iow, wildcards are also considered
>> literal characters).
>
> That sounds like a blatant bug to me (unless you are talking about
> "literal" case). We should fix it before we include it in any
> released version, I think.
Ah, no, I misread what you meant.
Yes, historically when matching a path with a pattern "a/b[c-d]/e",
we tried to first literally match the path with it (this allows the
path "a/b[c-d]/e" to match with the pattern), and if it did not
match, used fnmatch(3) to allow "a/bc/e" to also match. This was an
ugly hack to cope with the possiblity that such a funny path is
actually used in projects.
With :(literal) magic and its friends you are working into the
system, the hack should disappear at the same time when you stop
running fnmatch(3) without FNM_PATHNAME. That should happen no
later than Git 2.0.
But until then, we should keep matching both paths "a/bc/e" and
"a/b[c-d]/e" with pattern "a/b[c-d]/e", for backward compatibility.
Sorry about the earlier confusion.
prev parent reply other threads:[~2013-01-29 16:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-29 4:35 [RFC] The design of new pathspec features Duy Nguyen
2013-01-29 5:05 ` Junio C Hamano
2013-01-29 5:27 ` Duy Nguyen
2013-01-29 5:07 ` Junio C Hamano
2013-01-29 5:33 ` Junio C Hamano
2013-01-29 6:13 ` Duy Nguyen
2013-01-29 6:31 ` Junio C Hamano
2013-01-29 12:17 ` Duy Nguyen
2013-01-29 16:20 ` Junio C Hamano
2013-01-29 16:27 ` Junio C Hamano [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=7vd2worm3q.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.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).