threads / patch / 33980

patchMakefile: promote wildmatch to be the default fnmatch implementation

Subject: [PATCH] Makefile: promote wildmatch to be the default fnmatch implementation

## tl;dr

3 messages between May 30, 2013 and May 30, 2013. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Nguyễn Thái Ngọc Duy· May 30, 2013, 01:34 UTC · lore

This makes git use wildmatch by default for all fnmatch() calls. Users who want to use system fnmatch (or compat fnmatch) need to set NO_WILDMATCH flag.

wildmatch is a drop-in fnmatch replacement with more features. Using wildmatch gives us a consistent behavior across platforms. The tentative plan is make it default with an opt-out for about 2 cycles, then remove NO_WILDMATCH and compat/fnmatch.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Show changes to Makefile +2 −2
diff --git a/Makefile b/Makefile
index 0f931a2..efc8439 100644
--- a/Makefile
+++ b/Makefile
@@ -106,7 +106,7 @@ all::
 # Define NO_FNMATCH_CASEFOLD if your fnmatch function doesn't have the
 # FNM_CASEFOLD GNU extension.
 #
-# Define USE_WILDMATCH if you want to use Git's wildmatch
+# Define NO_WILDMATCH if you do not want to use Git's wildmatch
 # implementation as fnmatch
 #
 # Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
@@ -1261,7 +1261,7 @@ ifdef NO_FNMATCH_CASEFOLD
 	COMPAT_OBJS += compat/fnmatch/fnmatch.o
 endif
 endif
-ifdef USE_WILDMATCH
+ifndef NO_WILDMATCH
 	COMPAT_CFLAGS += -DUSE_WILDMATCH
 endif
 ifdef NO_SETENV
-- 
1.8.2.82.gc24b958
Junio C Hamano· May 30, 2013, 02:25 UTC · re: Nguyễn Thái Ngọc Duy · lore

Re: [PATCH] Makefile: promote wildmatch to be the default fnmatch implementation

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 6 quoted lines
> This makes git use wildmatch by default for all fnmatch() calls. Users
> who want to use system fnmatch (or compat fnmatch) need to set
> NO_WILDMATCH flag.
>
> wildmatch is a drop-in fnmatch replacement with more features. Using
> wildmatch gives us a consistent behavior across platforms.

Hmph, could you (no need to hurry, though) check the previous discussion and point at what we decided if we did reach any conclusion to refresh our collective memory?

While I agree this is a good move in the longer term in that we get the often-asked-for "foo/**/*.c" match and also we have one less platform differences to worry about, I somehow have a recollection that we discussed that there are incompatibilities in dark corners we would want to warn users about and lay a transition plan across some major version bump.

Thanks.
Duy Nguyen· May 30, 2013, 11:37 UTC · re: Junio C Hamano · lore

Re: [PATCH] Makefile: promote wildmatch to be the default fnmatch implementation

On Thu, May 30, 2013 at 9:25 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> This makes git use wildmatch by default for all fnmatch() calls. Users
>> who want to use system fnmatch (or compat fnmatch) need to set
>> NO_WILDMATCH flag.
>>
>> wildmatch is a drop-in fnmatch replacement with more features. Using
>> wildmatch gives us a consistent behavior across platforms.
>
> While I agree this is a good move in the longer term in that we get
> the often-asked-for "foo/**/*.c" match and also we have one less
> platform differences to worry about, I somehow have a recollection
> that we discussed that there are incompatibilities in dark corners
> we would want to warn users about and lay a transition plan across
> some major version bump.

I've skimmed through all wildmatch related mails in my gmail archive. There are differences between fnmatch versions, e.g. [1], but I don't think anyone would run into those cases on purpose. There were performance concerns [2] and they should have been addressed with nd/retire-fnmatch series. Originally I was worried that this new code might not be mature enough, but I've been running wildmatch-only git for quite some time, can't really complain.

Not really a transition plan, but maybe we could provide a runtime switch to return to system fnmatch when wildmatch becomes default, for a few cycles. This way if wildmatch turns out broken, people can switch back while we work on a fix.

> Hmph, could you (no need to hurry, though) check the previous
> discussion and point at what we decided if we did reach any
> conclusion to refresh our collective memory?

We all seemed to agree that the replacement would be a way to go. But not hard decision was reached.

[1] http://thread.gmane.org/gmane.comp.version-control.git/207385/focus=207540 [2] http://thread.gmane.org/gmane.comp.version-control.git/211823/focus=211836 -- Duy

← back to recent threads