Skip to content

Commit

Permalink
pathspec: rename per-item field has_wildcard to use_wildcard
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Apr 5, 2011
1 parent 97d0b74 commit 33e0f62
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion builtin/ls-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ void overlay_tree_on_cache(const char *tree_name, const char *prefix)
matchbuf[0] = prefix;
matchbuf[1] = NULL;
init_pathspec(&pathspec, matchbuf);
pathspec.items[0].has_wildcard = 0;
pathspec.items[0].use_wildcard = 0;
} else
init_pathspec(&pathspec, NULL);
if (read_tree(tree, 1, &pathspec))
Expand Down
3 changes: 2 additions & 1 deletion builtin/ls-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)

init_pathspec(&pathspec, get_pathspec(prefix, argv + 1));
for (i = 0; i < pathspec.nr; i++)
pathspec.items[i].has_wildcard = 0;
pathspec.items[i].use_wildcard = 0;
pathspec.has_wildcard = 0;
tree = parse_tree_indirect(sha1);
if (!tree)
die("not a tree object");
Expand Down
2 changes: 1 addition & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ struct pathspec {
struct pathspec_item {
const char *match;
int len;
unsigned int has_wildcard:1;
unsigned int use_wildcard:1;
} *items;
};

Expand Down
6 changes: 3 additions & 3 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ static int match_pathspec_item(const struct pathspec_item *item, int prefix,
return MATCHED_RECURSIVELY;
}

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

return 0;
Expand Down Expand Up @@ -1286,8 +1286,8 @@ int init_pathspec(struct pathspec *pathspec, const char **paths)

item->match = path;
item->len = strlen(path);
item->has_wildcard = !no_wildcard(path);
if (item->has_wildcard)
item->use_wildcard = !no_wildcard(path);
if (item->use_wildcard)
pathspec->has_wildcard = 1;
}

Expand Down
4 changes: 2 additions & 2 deletions tree-walk.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ int tree_entry_interesting(const struct name_entry *entry,
&never_interesting))
return 1;

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

Expand All @@ -614,7 +614,7 @@ int tree_entry_interesting(const struct name_entry *entry,
}

match_wildcards:
if (!ps->items[i].has_wildcard)
if (!ps->items[i].use_wildcard)
continue;

/*
Expand Down

0 comments on commit 33e0f62

Please sign in to comment.