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>

Adam Spiers committed Jan 6, 2013 at 16:58 UTC 4b78d7bccdda25290ab6c04bf45d835b4fdfab45
3 files changed +13 -12
builtin/add.c
+2 -2
@@ -117,7 +117,7 @@ static char *prune_directory(struct dir_struct *dir, const char **pathspec, int
117 *dst++ = entry;
118 }
119 dir->nr = dst - dir->entries;
120 - fill_pathspec_matches(pathspec, seen, specs);
120 + add_pathspec_matches_against_index(pathspec, seen, specs);
121 return seen;
122 }
123
@@ -415,7 +415,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
415
416 path_exclude_check_init(&check, &dir);
417 if (!seen)
418 - seen = find_used_pathspec(pathspec);
418 + seen = find_pathspecs_matching_against_index(pathspec);
419 for (i = 0; pathspec[i]; i++) {
420 if (!seen[i] && pathspec[i][0]
421 && !file_exists(pathspec[i])) {
pathspec.c
+9 -8
@@ -13,9 +13,10 @@
13 * altogether if seen[] already only contains non-zero entries.
14 *
15 * 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.
17 */
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)
20 {
21 int num_unmatched = 0, i;
22
@@ -39,12 +40,12 @@ void fill_pathspec_matches(const char **pathspec, char *seen, int specs)
40 /*
41 * Finds which of the given pathspecs match items in the index.
42 *
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.
47 */
47 -char *find_used_pathspec(const char **pathspec)
48 +char *find_pathspecs_matching_against_index(const char **pathspec)
49 {
50 char *seen;
51 int i;
@@ -52,6 +53,6 @@ char *find_used_pathspec(const char **pathspec)
53 for (i = 0; pathspec[i]; i++)
54 ; /* just counting */
55 seen = xcalloc(i, 1);
55 - fill_pathspec_matches(pathspec, seen, i);
56 + add_pathspec_matches_against_index(pathspec, seen, i);
57 return seen;
58 }
pathspec.h
+2 -2
@@ -1,7 +1,7 @@
1 #ifndef PATHSPEC_H
2 #define PATHSPEC_H
3
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);
6
7 #endif /* PATHSPEC_H */