summaryrefslogtreecommitdiff
path: root/tree-walk.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-10-10 15:56:20 -0700
committerJunio C Hamano <gitster@pobox.com>2011-10-10 15:56:20 -0700
commit4909bbe40af6dd12bc4aeb6b9e449a9e29641a26 (patch)
treefbb88d2201362d2a0321ff939d81b137d6325d26 /tree-walk.c
parent59b32ff338da1bd61b0df60386802cfc2edcb54c (diff)
parent1b74092373898a53885cfb7e89aa54f9329a92d3 (diff)
downloadgit-4909bbe40af6dd12bc4aeb6b9e449a9e29641a26.tar.gz
Merge branch 'dm/tree-walk'
* dm/tree-walk: tree-walk: micro-optimization in tree_entry_interesting tree-walk: drop unused parameter from match_dir_prefix
Diffstat (limited to 'tree-walk.c')
-rw-r--r--tree-walk.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tree-walk.c b/tree-walk.c
index a8d8a66d59..418107ec83 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -549,7 +549,7 @@ static int match_entry(const struct name_entry *entry, int pathlen,
return 0;
}
-static int match_dir_prefix(const char *base, int baselen,
+static int match_dir_prefix(const char *base,
const char *match, int matchlen)
{
if (strncmp(base, match, matchlen))
@@ -606,7 +606,7 @@ int tree_entry_interesting(const struct name_entry *entry,
if (baselen >= matchlen) {
/* If it doesn't match, move along... */
- if (!match_dir_prefix(base_str, baselen, match, matchlen))
+ if (!match_dir_prefix(base_str, match, matchlen))
goto match_wildcards;
if (!ps->recursive || ps->max_depth == -1)
@@ -618,8 +618,8 @@ int tree_entry_interesting(const struct name_entry *entry,
ps->max_depth);
}
- /* Does the base match? */
- if (!strncmp(base_str, match, baselen)) {
+ /* Either there must be no base, or the base must match. */
+ if (baselen == 0 || !strncmp(base_str, match, baselen)) {
if (match_entry(entry, pathlen,
match + baselen, matchlen - baselen,
&never_interesting))