X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=tree.c;h=5ab90af256a664366f3f92b467f52634c0df3f79;hb=a97a74686d70a318cd802003498054cc1e8b0ae2;hp=25d2e29fa8b1dfb964b97a10898c77d8fe86ef78;hpb=f7446fc6bbe9c25f7064ba76b2db4dd67691f7d0;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? */