summaryrefslogtreecommitdiff
path: root/test-path-utils.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-08-04 06:47:48 +0200
committerJunio C Hamano <gitster@pobox.com>2011-08-04 15:57:18 -0700
commit9e8137238d1b7f558dd61c8737883e73c8368e4b (patch)
tree5637fab8b715602fdc4654926a51ae03ed3fafb5 /test-path-utils.c
parent87a246e1b562544c25af66f4712cd81bc64f2d44 (diff)
downloadgit-9e8137238d1b7f558dd61c8737883e73c8368e4b.tar.gz
test-path-utils: Add subcommand "prefix_path"
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'test-path-utils.c')
-rw-r--r--test-path-utils.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test-path-utils.c b/test-path-utils.c
index a410e3026f..3bc20e91da 100644
--- a/test-path-utils.c
+++ b/test-path-utils.c
@@ -35,6 +35,19 @@ int main(int argc, char **argv)
return 0;
}
+ if (argc >= 4 && !strcmp(argv[1], "prefix_path")) {
+ char *prefix = argv[2];
+ int prefix_len = strlen(prefix);
+ int nongit_ok;
+ setup_git_directory_gently(&nongit_ok);
+ while (argc > 3) {
+ puts(prefix_path(prefix, prefix_len, argv[3]));
+ argc--;
+ argv++;
+ }
+ return 0;
+ }
+
if (argc == 4 && !strcmp(argv[1], "strip_path_suffix")) {
char *prefix = strip_path_suffix(argv[2], argv[3]);
printf("%s\n", prefix ? prefix : "(null)");