summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cache-tree.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 0bbec43216..4d439bd915 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -564,10 +564,9 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat
if (!sub)
return NULL;
it = sub->cache_tree;
- if (slash)
- while (*slash && *slash == '/')
- slash++;
- if (!slash || !*slash)
+ while (*slash && *slash == '/')
+ slash++;
+ if (!*slash)
return it; /* prefix ended with slashes */
path = slash;
}