pathspec: rename per-item field has_wildcard to use_wildcard
As the point of the last change is to allow use of strings as literals no matter what characters are in them, "has_wildcard" does not match what we use this field for anymore. It is used to decide if the wildcard matching should be used, so rename it to match the usage better. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Apr 5, 2011 at 09:30 UTC
33e0f62ba981ebfdcab8c9fb6d2935712a7b9d41
5 files changed
+9
-8
builtin/ls-files.c
+1
-1
@@ -361,7 +361,7 @@ void overlay_tree_on_cache(const char *tree_name, const char *prefix)
361
matchbuf[0] = prefix;
362
matchbuf[1] = NULL;
363
init_pathspec(&pathspec, matchbuf);
364
- pathspec.items[0].has_wildcard = 0;
364
+ pathspec.items[0].use_wildcard = 0;
365
} else
366
init_pathspec(&pathspec, NULL);
367
if (read_tree(tree, 1, &pathspec))
builtin/ls-tree.c
+2
-1
@@ -168,7 +168,8 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
168
169
init_pathspec(&pathspec, get_pathspec(prefix, argv + 1));
170
for (i = 0; i < pathspec.nr; i++)
171
- pathspec.items[i].has_wildcard = 0;
171
+ pathspec.items[i].use_wildcard = 0;
172
+ pathspec.has_wildcard = 0;
173
tree = parse_tree_indirect(sha1);
174
if (!tree)
175
die("not a tree object");
cache.h
+1
-1
@@ -509,7 +509,7 @@ struct pathspec {
509
struct pathspec_item {
510
const char *match;
511
int len;
512
- unsigned int has_wildcard:1;
512
+ unsigned int use_wildcard:1;
513
} *items;
514
};
515
dir.c
+3
-3
@@ -230,7 +230,7 @@ static int match_pathspec_item(const struct pathspec_item *item, int prefix,
230
return MATCHED_RECURSIVELY;
231
}
232
233
- if (item->has_wildcard && !fnmatch(match, name, 0))
233
+ if (item->use_wildcard && !fnmatch(match, name, 0))
234
return MATCHED_FNMATCH;
235
236
return 0;
@@ -1286,8 +1286,8 @@ int init_pathspec(struct pathspec *pathspec, const char **paths)
1286
1287
item->match = path;
1288
item->len = strlen(path);
1289
- item->has_wildcard = !no_wildcard(path);
1290
- if (item->has_wildcard)
1289
+ item->use_wildcard = !no_wildcard(path);
1290
+ if (item->use_wildcard)
1291
pathspec->has_wildcard = 1;
1292
}
1293
tree-walk.c
+2
-2
@@ -598,7 +598,7 @@ int tree_entry_interesting(const struct name_entry *entry,
598
&never_interesting))
599
return 1;
600
601
- if (ps->items[i].has_wildcard) {
601
+ if (ps->items[i].use_wildcard) {
602
if (!fnmatch(match + baselen, entry->path, 0))
603
return 1;
604
@@ -614,7 +614,7 @@ int tree_entry_interesting(const struct name_entry *entry,
614
}
615
616
match_wildcards:
617
- if (!ps->items[i].has_wildcard)
617
+ if (!ps->items[i].use_wildcard)
618
continue;
619
620
/*