Re: [PATCH 3/3] Convert all fnmatch() calls to wildmatch()

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 3/3] Convert all fnmatch() calls to wildmatch()

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:55:33

Nguyễn Thái Ngọc Duy  [off-list ref] writes:
quoted hunk
diff --git a/tree-walk.c b/tree-walk.c
index 492c7cd..c729e89 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -3,6 +3,7 @@
 #include "unpack-trees.h"
 #include "dir.h"
 #include "tree.h"
+#include "wildmatch.h"
 
 static const char *get_mode(const char *str, unsigned int *modep)
 {
@@ -627,7 +628,7 @@ enum interesting tree_entry_interesting(const struct name_entry *entry,
 				return entry_interesting;
 
 			if (item->use_wildcard) {
-				if (!fnmatch(match + baselen, entry->path, 0))
+				if (!wildmatch(match + baselen, entry->path, 0))
 					return entry_interesting;
This and the change to dir.c obviously have interactions with
8c6abbc (pathspec: apply "*.c" optimization from exclude,
2012-11-24).

I've already alluded to it in my response to 2/3, I guess.

Re: [PATCH 3/3] Convert all fnmatch() calls to wildmatch()

From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:55:34

On Thu, Dec 20, 2012 at 1:36 AM, Junio C Hamano [off-list ref] wrote:
quoted
@@ -627,7 +628,7 @@ enum interesting tree_entry_interesting(const struct name_entry *entry,
                              return entry_interesting;

                      if (item->use_wildcard) {
-                             if (!fnmatch(match + baselen, entry->path, 0))
+                             if (!wildmatch(match + baselen, entry->path, 0))
                                      return entry_interesting;
This and the change to dir.c obviously have interactions with
8c6abbc (pathspec: apply "*.c" optimization from exclude,
2012-11-24).

I've already alluded to it in my response to 2/3, I guess.
Conflict of plans. I did not expect myself to work on replacing
fnmatch soon and git_fnmatch is an intermediate step to collect more
optimizations and gradually replace fnmatch. Eventually git_fnmatch()
would become a wrapper of wildmatch, all the optimizations are pushed
down there. If we replace fnmatch->wildmatch first then there's little
reason for the existence of git_fnmatch(). Maybe I should merge this
with the fnmatch elimination into a single series.
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help