diff options
author | Russell Belfer <rb@github.com> | 2013-07-08 22:46:36 -0700 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2013-07-10 20:50:33 +0200 |
commit | 2b672d5b646edf94ae315a9f968611ff65508c90 (patch) | |
tree | 3902904ccac637c075418e2dbfbbaabc826dd6ab /src/diff.c | |
parent | 6fc5a58197bf04e1b5c6ca1bdb5765e90d3eb106 (diff) | |
download | libgit2-2b672d5b646edf94ae315a9f968611ff65508c90.tar.gz |
Add git_pathspec_match_diff API
This adds an additional pathspec API that will match a pathspec
against a diff object. This is convenient if you want to handle
renames (so you need the whole diff and can't use the pathspec
constraint built into the diff API) but still want to tell if the
diff had any files that matched the pathspec.
When the pathspec is matched against a diff, instead of keeping
a list of filenames that matched, instead the API keeps the list
of git_diff_deltas that matched and they can be retrieved via a
new API git_pathspec_match_list_diff_entry.
There are a couple of other minor API extensions here that were
mostly for the sake of convenience and to reduce dependencies
on knowing the internal data structure between files inside the
library.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/diff.c b/src/diff.c index 56232ebf4..cc7be451f 100644 --- a/src/diff.c +++ b/src/diff.c @@ -247,6 +247,11 @@ GIT_INLINE(const char *) diff_delta__path(const git_diff_delta *delta) return str; } +const char *git_diff_delta__path(const git_diff_delta *delta) +{ + return diff_delta__path(delta); +} + int git_diff_delta__cmp(const void *a, const void *b) { const git_diff_delta *da = a, *db = b; @@ -1235,6 +1240,11 @@ size_t git_diff_num_deltas_of_type(git_diff_list *diff, git_delta_t type) return count; } +int git_diff_is_sorted_icase(const git_diff_list *diff) +{ + return (diff->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE) != 0; +} + int git_diff__paired_foreach( git_diff_list *head2idx, git_diff_list *idx2wd, |