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