summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
authoryorah <yoram.harmelin@gmail.com>2012-07-23 18:16:09 +0200
committeryorah <yoram.harmelin@gmail.com>2012-07-24 14:03:09 +0200
commita1773f9d89887d299248d15b43953d3fa494a025 (patch)
tree4b204fca95ff0e11766eb3d570c919874d9908db /src/diff.c
parentffbc689c8768c66cddf9ef3ab6c88c41ecf4c1ab (diff)
downloadlibgit2-a1773f9d89887d299248d15b43953d3fa494a025.tar.gz
Add flag to turn off pathspec testing for diff and status
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/diff.c b/src/diff.c
index f08688e38..2b1529d63 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -61,9 +61,10 @@ static bool diff_path_matches_pathspec(git_diff_list *diff, const char *path)
return true;
git_vector_foreach(&diff->pathspec, i, match) {
- int result = strcmp(match->pattern, path);
+ int result = strcmp(match->pattern, path) ? FNM_NOMATCH : 0;
- if (result != 0)
+ if (((diff->opts.flags & GIT_DIFF_DISABLE_PATHSPEC_MATCH) == 0) &&
+ result == FNM_NOMATCH)
result = p_fnmatch(match->pattern, path, 0);
/* if we didn't match, look for exact dirname prefix match */