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