Skip to content

Commit 4b78d7b

Browse files
aspiersgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6f525e7 commit 4b78d7b

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

builtin/add.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static char *prune_directory(struct dir_struct *dir, const char **pathspec, int
117117
*dst++ = entry;
118118
}
119119
dir->nr = dst - dir->entries;
120-
fill_pathspec_matches(pathspec, seen, specs);
120+
add_pathspec_matches_against_index(pathspec, seen, specs);
121121
return seen;
122122
}
123123

@@ -415,7 +415,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
415415

416416
path_exclude_check_init(&check, &dir);
417417
if (!seen)
418-
seen = find_used_pathspec(pathspec);
418+
seen = find_pathspecs_matching_against_index(pathspec);
419419
for (i = 0; pathspec[i]; i++) {
420420
if (!seen[i] && pathspec[i][0]
421421
&& !file_exists(pathspec[i])) {

pathspec.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
* altogether if seen[] already only contains non-zero entries.
1414
*
1515
* If seen[] has not already been written to, it may make sense
16-
* to use find_used_pathspec() instead.
16+
* to use find_pathspecs_matching_against_index() instead.
1717
*/
18-
void fill_pathspec_matches(const char **pathspec, char *seen, int specs)
18+
void add_pathspec_matches_against_index(const char **pathspec,
19+
char *seen, int specs)
1920
{
2021
int num_unmatched = 0, i;
2122

@@ -39,19 +40,19 @@ void fill_pathspec_matches(const char **pathspec, char *seen, int specs)
3940
/*
4041
* Finds which of the given pathspecs match items in the index.
4142
*
42-
* This is a one-shot wrapper around fill_pathspec_matches() which
43-
* allocates, populates, and returns a seen[] array indicating the
44-
* nature of the "closest" (i.e. most specific) matches which each of
45-
* the given pathspecs achieves against all items in the index.
43+
* This is a one-shot wrapper around add_pathspec_matches_against_index()
44+
* which allocates, populates, and returns a seen[] array indicating the
45+
* nature of the "closest" (i.e. most specific) matches which each of the
46+
* given pathspecs achieves against all items in the index.
4647
*/
47-
char *find_used_pathspec(const char **pathspec)
48+
char *find_pathspecs_matching_against_index(const char **pathspec)
4849
{
4950
char *seen;
5051
int i;
5152

5253
for (i = 0; pathspec[i]; i++)
5354
; /* just counting */
5455
seen = xcalloc(i, 1);
55-
fill_pathspec_matches(pathspec, seen, i);
56+
add_pathspec_matches_against_index(pathspec, seen, i);
5657
return seen;
5758
}

pathspec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef PATHSPEC_H
22
#define PATHSPEC_H
33

4-
extern char *find_used_pathspec(const char **pathspec);
5-
extern void fill_pathspec_matches(const char **pathspec, char *seen, int specs);
4+
extern char *find_pathspecs_matching_against_index(const char **pathspec);
5+
extern void add_pathspec_matches_against_index(const char **pathspec, char *seen, int specs);
66

77
#endif /* PATHSPEC_H */

0 commit comments

Comments
 (0)