diff options
author | Russell Belfer <rb@github.com> | 2012-11-09 04:47:28 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-11-10 01:52:07 +0400 |
commit | 2e3d4b96c08f1b0e2ee9b248c53aec523d70fd25 (patch) | |
tree | 0f1ad5328b06715a742cc9fec9cd1d8f289ffb17 /src/pathspec.h | |
parent | 220d5a6c3572574a2fcf8869816390eadebbb792 (diff) |
Move pathspec code in separate files
Diff uses a `git_strarray` of path specs to represent a subset
of all files to be processed. It is useful to be able to reuse
this filtering in other places outside diff, so I've moved it
into a standalone set of utilities.
Diffstat (limited to 'src/pathspec.h')
-rw-r--r-- | src/pathspec.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/pathspec.h b/src/pathspec.h new file mode 100644 index 000000000..31a1cdad9 --- /dev/null +++ b/src/pathspec.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011-2012 the libgit2 contributors + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_pathspec_h__ +#define INCLUDE_pathspec_h__ + +#include "common.h" +#include "buffer.h" +#include "vector.h" +#include "pool.h" + +/* what is the common non-wildcard prefix for all items in the pathspec */ +extern char *git_pathspec_prefix(const git_strarray *pathspec); + +/* is there anything in the spec that needs to be filtered on */ +extern bool git_pathspec_is_interesting(const git_strarray *pathspec); + +/* build a vector of fnmatch patterns to evaluate efficiently */ +extern int git_pathspec_init( + git_vector *vspec, const git_strarray *strspec, git_pool *strpool); + +/* free data from the pathspec vector */ +extern void git_pathspec_free(git_vector *vspec); + +/* match a path against the vectorized pathspec */ +extern bool git_pathspec_match_path( + git_vector *vspec, const char *path, bool disable_fnmatch, bool casefold); + +#endif |