pathspec.c: rename newly public functions for clarity
Perform the following function renames to make it explicit that these pathspec handling functions are for matching against the index, rather than against a tree or the working directory. - fill_pathspec_matches() -> add_pathspec_matches_against_index() - find_used_pathspec() -> find_pathspecs_matching_against_index() Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
6f525e7100
commit
4b78d7bccd
@ -117,7 +117,7 @@ static char *prune_directory(struct dir_struct *dir, const char **pathspec, int
|
|||||||
*dst++ = entry;
|
*dst++ = entry;
|
||||||
}
|
}
|
||||||
dir->nr = dst - dir->entries;
|
dir->nr = dst - dir->entries;
|
||||||
fill_pathspec_matches(pathspec, seen, specs);
|
add_pathspec_matches_against_index(pathspec, seen, specs);
|
||||||
return seen;
|
return seen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
path_exclude_check_init(&check, &dir);
|
path_exclude_check_init(&check, &dir);
|
||||||
if (!seen)
|
if (!seen)
|
||||||
seen = find_used_pathspec(pathspec);
|
seen = find_pathspecs_matching_against_index(pathspec);
|
||||||
for (i = 0; pathspec[i]; i++) {
|
for (i = 0; pathspec[i]; i++) {
|
||||||
if (!seen[i] && pathspec[i][0]
|
if (!seen[i] && pathspec[i][0]
|
||||||
&& !file_exists(pathspec[i])) {
|
&& !file_exists(pathspec[i])) {
|
||||||
|
17
pathspec.c
17
pathspec.c
@ -13,9 +13,10 @@
|
|||||||
* altogether if seen[] already only contains non-zero entries.
|
* altogether if seen[] already only contains non-zero entries.
|
||||||
*
|
*
|
||||||
* If seen[] has not already been written to, it may make sense
|
* If seen[] has not already been written to, it may make sense
|
||||||
* to use find_used_pathspec() instead.
|
* to use find_pathspecs_matching_against_index() instead.
|
||||||
*/
|
*/
|
||||||
void fill_pathspec_matches(const char **pathspec, char *seen, int specs)
|
void add_pathspec_matches_against_index(const char **pathspec,
|
||||||
|
char *seen, int specs)
|
||||||
{
|
{
|
||||||
int num_unmatched = 0, i;
|
int num_unmatched = 0, i;
|
||||||
|
|
||||||
@ -39,12 +40,12 @@ void fill_pathspec_matches(const char **pathspec, char *seen, int specs)
|
|||||||
/*
|
/*
|
||||||
* Finds which of the given pathspecs match items in the index.
|
* Finds which of the given pathspecs match items in the index.
|
||||||
*
|
*
|
||||||
* This is a one-shot wrapper around fill_pathspec_matches() which
|
* This is a one-shot wrapper around add_pathspec_matches_against_index()
|
||||||
* allocates, populates, and returns a seen[] array indicating the
|
* which allocates, populates, and returns a seen[] array indicating the
|
||||||
* nature of the "closest" (i.e. most specific) matches which each of
|
* nature of the "closest" (i.e. most specific) matches which each of the
|
||||||
* the given pathspecs achieves against all items in the index.
|
* given pathspecs achieves against all items in the index.
|
||||||
*/
|
*/
|
||||||
char *find_used_pathspec(const char **pathspec)
|
char *find_pathspecs_matching_against_index(const char **pathspec)
|
||||||
{
|
{
|
||||||
char *seen;
|
char *seen;
|
||||||
int i;
|
int i;
|
||||||
@ -52,6 +53,6 @@ char *find_used_pathspec(const char **pathspec)
|
|||||||
for (i = 0; pathspec[i]; i++)
|
for (i = 0; pathspec[i]; i++)
|
||||||
; /* just counting */
|
; /* just counting */
|
||||||
seen = xcalloc(i, 1);
|
seen = xcalloc(i, 1);
|
||||||
fill_pathspec_matches(pathspec, seen, i);
|
add_pathspec_matches_against_index(pathspec, seen, i);
|
||||||
return seen;
|
return seen;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef PATHSPEC_H
|
#ifndef PATHSPEC_H
|
||||||
#define PATHSPEC_H
|
#define PATHSPEC_H
|
||||||
|
|
||||||
extern char *find_used_pathspec(const char **pathspec);
|
extern char *find_pathspecs_matching_against_index(const char **pathspec);
|
||||||
extern void fill_pathspec_matches(const char **pathspec, char *seen, int specs);
|
extern void add_pathspec_matches_against_index(const char **pathspec, char *seen, int specs);
|
||||||
|
|
||||||
#endif /* PATHSPEC_H */
|
#endif /* PATHSPEC_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user