diff options
| author | Ben Straub <bs@github.com> | 2013-09-16 16:12:31 -0700 |
|---|---|---|
| committer | Ben Straub <bs@github.com> | 2013-09-16 16:12:31 -0700 |
| commit | 549931679a77b280eb1f36afeda8930eb31d70f7 (patch) | |
| tree | 2744e3e198ad146bae72f35369bbeb4f8028c8c3 /src/pathspec.h | |
| parent | 1a68c168a6cdbe0db6e44fb582a7026a7d536c9d (diff) | |
| parent | 8821c9aa5baf31e21c21825e8c91c765e6631e7f (diff) | |
| download | libgit2-549931679a77b280eb1f36afeda8930eb31d70f7.tar.gz | |
Merge branch 'development' into blame_rebased
Conflicts:
include/git2.h
Diffstat (limited to 'src/pathspec.h')
| -rw-r--r-- | src/pathspec.h | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/src/pathspec.h b/src/pathspec.h index 43a94baad..40cd21c3f 100644 --- a/src/pathspec.h +++ b/src/pathspec.h @@ -8,9 +8,35 @@ #define INCLUDE_pathspec_h__ #include "common.h" +#include <git2/pathspec.h> #include "buffer.h" #include "vector.h" #include "pool.h" +#include "array.h" + +/* public compiled pathspec */ +struct git_pathspec { + git_refcount rc; + char *prefix; + git_vector 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(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 */ extern char *git_pathspec_prefix(const git_strarray *pathspec); @@ -19,22 +45,31 @@ extern char *git_pathspec_prefix(const git_strarray *pathspec); extern bool git_pathspec_is_empty(const git_strarray *pathspec); /* build a vector of fnmatch patterns to evaluate efficiently */ -extern int git_pathspec_init( +extern int git_pathspec__vinit( git_vector *vspec, const git_strarray *strspec, git_pool *strpool); /* free data from the pathspec vector */ -extern void git_pathspec_free(git_vector *vspec); +extern void git_pathspec__vfree(git_vector *vspec); + +#define GIT_PATHSPEC_NOMATCH ((size_t)-1) /* * Match a path against the vectorized pathspec. * The matched pathspec is passed back into the `matched_pathspec` parameter, * unless it is passed as NULL by the caller. */ -extern bool git_pathspec_match_path( - git_vector *vspec, +extern bool git_pathspec__match( + const git_vector *vspec, const char *path, bool disable_fnmatch, bool casefold, - const char **matched_pathspec); + const char **matched_pathspec, + size_t *matched_at); + +/* easy pathspec setup */ + +extern int git_pathspec__init(git_pathspec *ps, const git_strarray *paths); + +extern void git_pathspec__clear(git_pathspec *ps); #endif |
