diff --git a/cache-tree.c b/cache-tree.c
index 39ad8c9941..17db9f9045 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -565,8 +565,6 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat
 		it = sub->cache_tree;
 		while (*slash == '/')
 			slash++;
-		if (!*slash)
-			return it; /* prefix ended with slashes */
 		path = slash;
 	}
 	return it;