remove match_pathspec() in favor of match_pathspec_depth()
match_pathspec_depth was created to replace match_pathspec (see
61cf282 (pathspec: add match_pathspec_depth() - 2010-12-15). It took
more than two years, but the replacement finally happens :-)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
9a08727443
commit
84b8b5d1fa
19
pathspec.c
19
pathspec.c
@ -15,8 +15,8 @@
|
||||
* If seen[] has not already been written to, it may make sense
|
||||
* to use find_pathspecs_matching_against_index() instead.
|
||||
*/
|
||||
void add_pathspec_matches_against_index(const char **pathspec,
|
||||
char *seen, int specs)
|
||||
void add_pathspec_matches_against_index(const struct pathspec *pathspec,
|
||||
char *seen)
|
||||
{
|
||||
int num_unmatched = 0, i;
|
||||
|
||||
@ -26,14 +26,14 @@ void add_pathspec_matches_against_index(const char **pathspec,
|
||||
* mistakenly think that the user gave a pathspec that did not match
|
||||
* anything.
|
||||
*/
|
||||
for (i = 0; i < specs; i++)
|
||||
for (i = 0; i < pathspec->nr; i++)
|
||||
if (!seen[i])
|
||||
num_unmatched++;
|
||||
if (!num_unmatched)
|
||||
return;
|
||||
for (i = 0; i < active_nr; i++) {
|
||||
struct cache_entry *ce = active_cache[i];
|
||||
match_pathspec(pathspec, ce->name, ce_namelen(ce), 0, seen);
|
||||
match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, seen);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,15 +45,10 @@ void add_pathspec_matches_against_index(const char **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 char **pathspec)
|
||||
char *find_pathspecs_matching_against_index(const struct pathspec *pathspec)
|
||||
{
|
||||
char *seen;
|
||||
int i;
|
||||
|
||||
for (i = 0; pathspec[i]; i++)
|
||||
; /* just counting */
|
||||
seen = xcalloc(i, 1);
|
||||
add_pathspec_matches_against_index(pathspec, seen, i);
|
||||
char *seen = xcalloc(pathspec->nr, 1);
|
||||
add_pathspec_matches_against_index(pathspec, seen);
|
||||
return seen;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user