X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=test-path-utils.c;h=3bc20e91da561f4edd5c3eddb0988735759234e4;hb=ac86ec0f5e2dbd0d46fb000db1a65f1d2173a02d;hp=5168a8e3dfd5150de8def87980118e31e81296e7;hpb=8e4f767ba77051aedaac7ef6639ee990778866c7;p=git.git diff --git a/test-path-utils.c b/test-path-utils.c index 5168a8e3d..3bc20e91d 100644 --- a/test-path-utils.c +++ b/test-path-utils.c @@ -11,9 +11,18 @@ int main(int argc, char **argv) return 0; } - if (argc >= 2 && !strcmp(argv[1], "make_absolute_path")) { + if (argc >= 2 && !strcmp(argv[1], "real_path")) { while (argc > 2) { - puts(make_absolute_path(argv[2])); + puts(real_path(argv[2])); + argc--; + argv++; + } + return 0; + } + + if (argc >= 2 && !strcmp(argv[1], "absolute_path")) { + while (argc > 2) { + puts(absolute_path(argv[2])); argc--; argv++; } @@ -26,6 +35,25 @@ 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)"); + return 0; + } + fprintf(stderr, "%s: unknown function name: %s\n", argv[0], argv[1] ? argv[1] : "(there was none)"); return 1;