diff options
| author | yorah <yoram.harmelin@gmail.com> | 2012-07-23 18:16:09 +0200 |
|---|---|---|
| committer | yorah <yoram.harmelin@gmail.com> | 2012-07-24 14:03:09 +0200 |
| commit | a1773f9d89887d299248d15b43953d3fa494a025 (patch) | |
| tree | 4b204fca95ff0e11766eb3d570c919874d9908db /src | |
| parent | ffbc689c8768c66cddf9ef3ab6c88c41ecf4c1ab (diff) | |
| download | libgit2-a1773f9d89887d299248d15b43953d3fa494a025.tar.gz | |
Add flag to turn off pathspec testing for diff and status
Diffstat (limited to 'src')
| -rw-r--r-- | src/diff.c | 5 | ||||
| -rw-r--r-- | src/status.c | 2 |
2 files changed, 5 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 */ diff --git a/src/status.c b/src/status.c index 633082c09..d78237689 100644 --- a/src/status.c +++ b/src/status.c @@ -99,6 +99,8 @@ int git_status_foreach_ext( diffopt.flags = diffopt.flags | GIT_DIFF_INCLUDE_UNMODIFIED; if ((opts->flags & GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS) != 0) diffopt.flags = diffopt.flags | GIT_DIFF_RECURSE_UNTRACKED_DIRS; + if ((opts->flags & GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH) != 0) + diffopt.flags = diffopt.flags | GIT_DIFF_DISABLE_PATHSPEC_MATCH; /* TODO: support EXCLUDE_SUBMODULES flag */ if (show != GIT_STATUS_SHOW_WORKDIR_ONLY && |
