On 2017-01-11 13:15, Junio C Hamano wrote:
Richard Hansen <hansenr@xxxxxxxxxx> writes:
On 2017-01-10 21:46, Junio C Hamano wrote:
Richard Hansen <hansenr@xxxxxxxxxx> writes:
I was looking at the code to see how the two file formats differed and
noticed that match_order() doesn't set the WM_PATHNAME flag when it
calls wildmatch(). That's unintentional (a bug), right?
It has been that way from day one IIRC even before we introduced
wildmatch()---IOW it may be intentional that the current code that
uses wildmatch() does not use WM_PATHNAME.
You are the original author (af5323e027 2005-05-30). Do you remember
what your intention was?
Yes.
Back then we didn't even have wildmatch(), and used fnmatch()
instead, so forcing FNM_PATHNAME would have meant that people
wouldn't be able to say "foo*bar" to match "foo/other/bar"; with
wildmatch, "foo**bar" lets you defeat WM_PATHNAME so having
WM_PATHNAME always in effect is less of an issue, but with
fnmatch(), having FNM_PATHNAME always in effect has a lot of
downside.
Ah, that makes sense.
I'd expect that orderfile people have today will be broken and
require tweaking if you switched WM_PATHNAME on.
OK, so we don't want to turn on WM_PATHNAME unless we do it for a new
major version.
I'll do another re-roll and document the non-WM_PATHNAME behavior.
Perhaps I'll encourage users to prefer ** over * if they want to match
slash (even though they are equivalent) so that migration is easier if
we ever do turn on WM_PATHNAME.
-Richard