reset: improve worktree safety valves
[gitweb.git] / tree.c
diff --git a/tree.c b/tree.c
index 0d703a0c473e65c60d9e130b4e1fd50b79e9462b..5ab90af256a664366f3f92b467f52634c0df3f79 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -62,6 +62,7 @@ static int match_tree_entry(const char *base, int baselen, const char *path, uns
                                continue;
                        /* pathspecs match only at the directory boundaries */
                        if (!matchlen ||
+                           baselen == matchlen ||
                            base[matchlen] == '/' ||
                            match[matchlen - 1] == '/')
                                return 1;