tree-walk: micro-optimization in tree_entry_interesting
[gitweb.git] / tree-walk.c
index 9be800760c79638ff75f3b30c344e8a80697224d..f386151ce3719a258476533fc8b22979d9ce99b3 100644 (file)
@@ -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))