Re: [PATCH 2/2] diff: document the pattern format for diff.orderFile

2 messages, 2 authors, 2017-01-11 · open the first message on its own page

Re: [PATCH 2/2] diff: document the pattern format for diff.orderFile

From: Junio C Hamano <hidden>
Date: 2017-01-11 18:15:56

Richard Hansen [off-list ref] writes:
On 2017-01-10 21:46, Junio C Hamano wrote:
quoted
Richard Hansen [off-list ref] writes:
quoted
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.

I'd expect that orderfile people have today will be broken and
require tweaking if you switched WM_PATHNAME on.

Re: [PATCH 2/2] diff: document the pattern format for diff.orderFile

From: Richard Hansen <hidden>
Date: 2017-01-11 18:36:48

On 2017-01-11 13:15, Junio C Hamano wrote:
Richard Hansen [off-list ref] writes:
quoted
On 2017-01-10 21:46, Junio C Hamano wrote:
quoted
Richard Hansen [off-list ref] writes:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help