Skip to content

Commit

Permalink
test-path-utils: Add subcommand "prefix_path"
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
mhagger authored and gitster committed Aug 4, 2011
1 parent 87a246e commit 9e81372
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test-path-utils.c
Expand Up @@ -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)");
Expand Down

0 comments on commit 9e81372

Please sign in to comment.