summaryrefslogtreecommitdiff
path: root/pathspec.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-07-14 08:36:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-07-15 17:56:09 (GMT)
commit84b8b5d1fa244bc591291a3cf18bf0fa9976ad17 (patch)
tree67f5a9e9a0c5cb67fcd3694055403fcd4936b2be /pathspec.c
parent9a0872744315da67db3c81eb9270751e31fcc8f5 (diff)
downloadgit-84b8b5d1fa244bc591291a3cf18bf0fa9976ad17.zip
git-84b8b5d1fa244bc591291a3cf18bf0fa9976ad17.tar.gz
git-84b8b5d1fa244bc591291a3cf18bf0fa9976ad17.tar.bz2
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>
Diffstat (limited to 'pathspec.c')
-rw-r--r--pathspec.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/pathspec.c b/pathspec.c
index 74f0203..3d1386d 100644
--- a/pathspec.c
+++ b/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;
}