Skip to content

Commit 9e81372

Browse files
mhaggergitster
authored andcommitted
test-path-utils: Add subcommand "prefix_path"
Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 87a246e commit 9e81372

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test-path-utils.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ int main(int argc, char **argv)
3535
return 0;
3636
}
3737

38+
if (argc >= 4 && !strcmp(argv[1], "prefix_path")) {
39+
char *prefix = argv[2];
40+
int prefix_len = strlen(prefix);
41+
int nongit_ok;
42+
setup_git_directory_gently(&nongit_ok);
43+
while (argc > 3) {
44+
puts(prefix_path(prefix, prefix_len, argv[3]));
45+
argc--;
46+
argv++;
47+
}
48+
return 0;
49+
}
50+
3851
if (argc == 4 && !strcmp(argv[1], "strip_path_suffix")) {
3952
char *prefix = strip_path_suffix(argv[2], argv[3]);
4053
printf("%s\n", prefix ? prefix : "(null)");

0 commit comments

Comments
 (0)