summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-04-05 09:30:36 -0700
committerJunio C Hamano <gitster@pobox.com>2011-04-05 09:30:36 -0700
commit33e0f62ba981ebfdcab8c9fb6d2935712a7b9d41 (patch)
tree66e6704cb6ff05057c899819b40001d0803dfabb
parent97d0b74a49f0c81c3f9673c1a17721ac0624c3df (diff)
downloadgit-33e0f62ba981ebfdcab8c9fb6d2935712a7b9d41.tar.gz
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>
-rw-r--r--builtin/ls-files.c2
-rw-r--r--builtin/ls-tree.c3
-rw-r--r--cache.h2
-rw-r--r--dir.c6
-rw-r--r--tree-walk.c4
5 files changed, 9 insertions, 8 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 199af46360..15701233e2 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -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))
diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c
index 4290723392..f08c5b0c94 100644
--- a/builtin/ls-tree.c
+++ b/builtin/ls-tree.c
@@ -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");
diff --git a/cache.h b/cache.h
index edd5b5ad8f..43d719d71f 100644
--- a/cache.h
+++ b/cache.h
@@ -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;
};
diff --git a/dir.c b/dir.c
index 168dad6152..91f1502ac6 100644
--- a/dir.c
+++ b/dir.c
@@ -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;
@@ -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;
}
diff --git a/tree-walk.c b/tree-walk.c
index 322becc3b4..33f749e1e7 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -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;
@@ -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;
/*