X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=test-path-utils.c;h=3bc20e91da561f4edd5c3eddb0988735759234e4;hb=b476064544b9a64d062acc5e3c6be831ebb721cb;hp=e7671593df6bf014f3a9d8bd5173d1edcfd6545b;hpb=43176d1e4cddc4ab2f2f7dc6f3ba10513ffc2f2b;p=git.git diff --git a/test-path-utils.c b/test-path-utils.c index e7671593d..3bc20e91d 100644 --- a/test-path-utils.c +++ b/test-path-utils.c @@ -20,12 +20,34 @@ int main(int argc, char **argv) return 0; } + if (argc >= 2 && !strcmp(argv[1], "absolute_path")) { + while (argc > 2) { + puts(absolute_path(argv[2])); + argc--; + argv++; + } + return 0; + } + if (argc == 4 && !strcmp(argv[1], "longest_ancestor_length")) { int len = longest_ancestor_length(argv[2], argv[3]); printf("%d\n", len); 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)");