Skip to content

Commit 1daac3f

Browse files
committed
test-tool path-utils: support debugging "dubious ownership" issues
This adds a new sub-sub-command for `test-tool`, simply passing through the command-line arguments to the `is_path_owned_by_current_user()` function. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 90aec07 commit 1daac3f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

t/helper/test-path-utils.c

+19
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,25 @@ int cmd__path_utils(int argc, const char **argv)
504504
return !!res;
505505
}
506506

507+
if (argc > 1 && !strcmp(argv[1], "is_path_owned_by_current_user")) {
508+
int res = 0;
509+
510+
for (int i = 2; i < argc; i++) {
511+
struct strbuf buf = STRBUF_INIT;
512+
513+
if (is_path_owned_by_current_user(argv[i], &buf))
514+
printf("'%s' is owned by current SID\n", argv[i]);
515+
else {
516+
printf("'%s' is not owned by current SID: %s\n", argv[i], buf.buf);
517+
res = 1;
518+
}
519+
520+
strbuf_release(&buf);
521+
}
522+
523+
return res;
524+
}
525+
507526
fprintf(stderr, "%s: unknown function name: %s\n", argv[0],
508527
argv[1] ? argv[1] : "(there was none)");
509528
return 1;

0 commit comments

Comments
 (0)