diff options
author | yorah <yoram.harmelin@gmail.com> | 2013-01-18 16:37:13 +0100 |
---|---|---|
committer | yorah <yoram.harmelin@gmail.com> | 2013-02-07 20:44:34 +0100 |
commit | 943700ecbbc2be4ef49c5c31d8e5c49353fd3d84 (patch) | |
tree | 4e49b623e5df6506acb995ed5b492ff18d658a18 /src/diff.c | |
parent | 41713ec15f66d263c2d7d40dd07f1f5a468e3e22 (diff) | |
download | libgit2-943700ecbbc2be4ef49c5c31d8e5c49353fd3d84.tar.gz |
Return the matched pathspec pattern in `git_pathspec_match_path`
Instead of returning directly the pattern as the return value, I used an
out parameter, because the function also tests if the passed pathspecs
vector is empty. If yes, it considers that the path "matches", but in
that case there is no matched pattern per se.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/diff.c b/src/diff.c index 4b60935f0..3e8028551 100644 --- a/src/diff.c +++ b/src/diff.c @@ -47,6 +47,7 @@ static int diff_delta__from_one( const git_index_entry *entry) { git_diff_delta *delta; + const char *matched_pathspec; if (status == GIT_DELTA_IGNORED && (diff->opts.flags & GIT_DIFF_INCLUDE_IGNORED) == 0) @@ -59,7 +60,7 @@ static int diff_delta__from_one( if (!git_pathspec_match_path( &diff->pathspec, entry->path, (diff->opts.flags & GIT_DIFF_DISABLE_PATHSPEC_MATCH) != 0, - (diff->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE) != 0)) + (diff->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE) != 0, &matched_pathspec)) return 0; delta = diff_delta__alloc(diff, status, entry->path); @@ -419,13 +420,14 @@ static int maybe_modified( unsigned int omode = oitem->mode; unsigned int nmode = nitem->mode; bool new_is_workdir = (new_iter->type == GIT_ITERATOR_TYPE_WORKDIR); + const char *matched_pathspec; GIT_UNUSED(old_iter); if (!git_pathspec_match_path( &diff->pathspec, oitem->path, (diff->opts.flags & GIT_DIFF_DISABLE_PATHSPEC_MATCH) != 0, - (diff->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE) != 0)) + (diff->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE) != 0, &matched_pathspec)) return 0; /* on platforms with no symlinks, preserve mode of existing symlinks */ |