Skip to content

Commit 33e0f62

Browse files
committed
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 <[email protected]>
1 parent 97d0b74 commit 33e0f62

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

builtin/ls-files.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ void overlay_tree_on_cache(const char *tree_name, const char *prefix)
361361
matchbuf[0] = prefix;
362362
matchbuf[1] = NULL;
363363
init_pathspec(&pathspec, matchbuf);
364-
pathspec.items[0].has_wildcard = 0;
364+
pathspec.items[0].use_wildcard = 0;
365365
} else
366366
init_pathspec(&pathspec, NULL);
367367
if (read_tree(tree, 1, &pathspec))

builtin/ls-tree.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
168168

169169
init_pathspec(&pathspec, get_pathspec(prefix, argv + 1));
170170
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;
172173
tree = parse_tree_indirect(sha1);
173174
if (!tree)
174175
die("not a tree object");

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ struct pathspec {
509509
struct pathspec_item {
510510
const char *match;
511511
int len;
512-
unsigned int has_wildcard:1;
512+
unsigned int use_wildcard:1;
513513
} *items;
514514
};
515515

dir.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static int match_pathspec_item(const struct pathspec_item *item, int prefix,
230230
return MATCHED_RECURSIVELY;
231231
}
232232

233-
if (item->has_wildcard && !fnmatch(match, name, 0))
233+
if (item->use_wildcard && !fnmatch(match, name, 0))
234234
return MATCHED_FNMATCH;
235235

236236
return 0;
@@ -1286,8 +1286,8 @@ int init_pathspec(struct pathspec *pathspec, const char **paths)
12861286

12871287
item->match = path;
12881288
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)
12911291
pathspec->has_wildcard = 1;
12921292
}
12931293

tree-walk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ int tree_entry_interesting(const struct name_entry *entry,
598598
&never_interesting))
599599
return 1;
600600

601-
if (ps->items[i].has_wildcard) {
601+
if (ps->items[i].use_wildcard) {
602602
if (!fnmatch(match + baselen, entry->path, 0))
603603
return 1;
604604

@@ -614,7 +614,7 @@ int tree_entry_interesting(const struct name_entry *entry,
614614
}
615615

616616
match_wildcards:
617-
if (!ps->items[i].has_wildcard)
617+
if (!ps->items[i].use_wildcard)
618618
continue;
619619

620620
/*

0 commit comments

Comments
 (0)