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/pathspec.h | |
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/pathspec.h')
-rw-r--r-- | src/pathspec.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pathspec.h b/src/pathspec.h index e7edfea38..40cd21c3f 100644 --- a/src/pathspec.h +++ b/src/pathspec.h @@ -22,12 +22,20 @@ struct git_pathspec { git_pool pool; }; +enum { + PATHSPEC_DATATYPE_STRINGS = 0, + PATHSPEC_DATATYPE_DIFF = 1, +}; + +typedef git_array_t(char *) git_pathspec_string_array_t; + /* public interface to pathspec matching */ struct git_pathspec_match_list { git_pathspec *pathspec; - git_array_t(char *) matches; - git_array_t(char *) failures; + git_array_t(void *) matches; + git_pathspec_string_array_t failures; git_pool pool; + int datatype; }; /* what is the common non-wildcard prefix for all items in the pathspec */ |