aboutsummaryrefslogtreecommitdiff
path: root/test-path-utils.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2012-10-28 17:16:24 +0100
committerJeff King <peff@peff.net>2012-10-29 02:34:58 -0400
commit31171d9e454d71144685866cfd6476b8ac69d314 (patch)
tree518d646035a3ea9415472e7f874d396d52b07822 /test-path-utils.c
parenta5ccdbe416081d5749f286c193b70400e48ad03f (diff)
downloadgit-31171d9e454d71144685866cfd6476b8ac69d314.tar.gz
git-31171d9e454d71144685866cfd6476b8ac69d314.tar.xz
longest_ancestor_length(): take a string_list argument for prefixes
Change longest_ancestor_length() to take the prefixes argument as a string_list rather than as a colon-separated string. This will make it easier for the caller to alter the entries before calling longest_ancestor_length(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'test-path-utils.c')
-rw-r--r--test-path-utils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/test-path-utils.c b/test-path-utils.c
index 3bc20e91d..acb05600d 100644
--- a/test-path-utils.c
+++ b/test-path-utils.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "string-list.h"
int main(int argc, char **argv)
{
@@ -30,7 +31,12 @@ int main(int argc, char **argv)
}
if (argc == 4 && !strcmp(argv[1], "longest_ancestor_length")) {
- int len = longest_ancestor_length(argv[2], argv[3]);
+ int len;
+ struct string_list ceiling_dirs = STRING_LIST_INIT_DUP;
+
+ string_list_split(&ceiling_dirs, argv[3], PATH_SEP, -1);
+ len = longest_ancestor_length(argv[2], &ceiling_dirs);
+ string_list_clear(&ceiling_dirs, 0);
printf("%d\n", len);
return 0;
}