Re: [PATCH] wildmatch: change behavior of "foo**bar" in WM_PATHNAME mode
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 29, 2018, 02:28 UTC
- Message-ID
- <xmqqin1l8p1i.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <CACsJy8BoWmWaVpXnSL8Stm_2XDnKfXSaj2i0UwZg7aEgYF9i4w@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 8 quoted lines
>> Nice analyzes. >> I have one question here: >> If the user specifies '**' and nothing is found, >> would it be better to die() with a useful message >> instead of silently correcting it ? > > Consider the main use case of wildmatch, .gitignore patterns, dying > would be really bad because it can affect a lot of commands....
If the user gives 'foo*' and nothing is found, we may say "no match" and some codepaths that uses wildmatch API may die. And in such place, when the user gives '**' and nothing is found, we should do the same in the same codepath. In either case, the implementation of wildmatch API is not the place to call a die(), I think.
And yes, treating an unanchored "**" as if there is just a "*" followed by another '*" makes good sense.
Thanks, both.