diff options
author | Brandon Williams <bmwill@google.com> | 2017-05-12 00:04:27 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-12 07:23:46 +0200 |
commit | 08de9151a8a67f29a3a5a36931298237d78ca736 (patch) | |
tree | e592ee783330d7e4f73315706f56a9cf46a15857 /pathspec.c | |
parent | pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP (diff) | |
download | git-08de9151a8a67f29a3a5a36931298237d78ca736.tar.xz git-08de9151a8a67f29a3a5a36931298237d78ca736.zip |
pathspec: convert find_pathspecs_matching_against_index to take an index
Convert find_pathspecs_matching_against_index to take an index
parameter.
In addition mark pathspec.c with NO_THE_INDEX_COMPATIBILITY_MACROS now
that it doesn't use any cache macros or reference 'the_index'.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pathspec.c')
-rw-r--r-- | pathspec.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pathspec.c b/pathspec.c index 1e5df2316e..828405021f 100644 --- a/pathspec.c +++ b/pathspec.c @@ -1,3 +1,4 @@ +#define NO_THE_INDEX_COMPATIBILITY_MACROS #include "cache.h" #include "dir.h" #include "pathspec.h" @@ -17,6 +18,7 @@ * to use find_pathspecs_matching_against_index() instead. */ void add_pathspec_matches_against_index(const struct pathspec *pathspec, + const struct index_state *istate, char *seen) { int num_unmatched = 0, i; @@ -32,8 +34,8 @@ void add_pathspec_matches_against_index(const struct pathspec *pathspec, num_unmatched++; if (!num_unmatched) return; - for (i = 0; i < active_nr; i++) { - const struct cache_entry *ce = active_cache[i]; + for (i = 0; i < istate->cache_nr; i++) { + const struct cache_entry *ce = istate->cache[i]; ce_path_match(ce, pathspec, seen); } } @@ -46,10 +48,11 @@ void add_pathspec_matches_against_index(const struct pathspec *pathspec, * nature of the "closest" (i.e. most specific) matches which each of the * given pathspecs achieves against all items in the index. */ -char *find_pathspecs_matching_against_index(const struct pathspec *pathspec) +char *find_pathspecs_matching_against_index(const struct pathspec *pathspec, + const struct index_state *istate) { char *seen = xcalloc(pathspec->nr, 1); - add_pathspec_matches_against_index(pathspec, seen); + add_pathspec_matches_against_index(pathspec, istate, seen); return seen; } |