summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tree-walk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tree-walk.c b/tree-walk.c
index 9be800760c..f386151ce3 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -591,8 +591,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))