X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=tree.c;h=5ab90af256a664366f3f92b467f52634c0df3f79;hb=54e0e6edfa60f84b582112804365e207e70f44a6;hp=25d2e29fa8b1dfb964b97a10898c77d8fe86ef78;hpb=f474c526618d5d1111b585a6344e012fb731d3fe;p=git.git diff --git a/tree.c b/tree.c index 25d2e29fa..5ab90af25 100644 --- a/tree.c +++ b/tree.c @@ -60,8 +60,13 @@ static int match_tree_entry(const char *base, int baselen, const char *path, uns /* If it doesn't match, move along... */ if (strncmp(base, match, matchlen)) continue; - /* The base is a subdirectory of a path which was specified. */ - return 1; + /* pathspecs match only at the directory boundaries */ + if (!matchlen || + baselen == matchlen || + base[matchlen] == '/' || + match[matchlen - 1] == '/') + return 1; + continue; } /* Does the base match? */