summaryrefslogtreecommitdiff
path: root/src/pathspec.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-08-09 11:20:49 -0700
committerRussell Belfer <rb@github.com>2013-08-09 11:20:49 -0700
commitb7b77def931be50777884ddd35a8689df0ecbebd (patch)
tree633f6014c39b4036f59a7a3b951f1010538ddbe7 /src/pathspec.c
parent4ba64794aee983483eef659623a765d61311ded1 (diff)
downloadlibgit2-b7b77def931be50777884ddd35a8689df0ecbebd.tar.gz
Match against file with leading ! was too broad
Diffstat (limited to 'src/pathspec.c')
-rw-r--r--src/pathspec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pathspec.c b/src/pathspec.c
index 1d7b71a74..d56d03918 100644
--- a/src/pathspec.c
+++ b/src/pathspec.c
@@ -166,7 +166,8 @@ static int pathspec_match_one(
if (result == FNM_NOMATCH &&
(match->flags & GIT_ATTR_FNMATCH_NEGATIVE) != 0 &&
*path == '!' &&
- ctxt->strncomp(path + 1, match->pattern, match->length) == 0)
+ ctxt->strncomp(path + 1, match->pattern, match->length) == 0 &&
+ (!path[match->length + 1] || path[match->length + 1] == '/'))
return 1;
if (result == 0)