Skip to content

Commit c6585c2

Browse files
committed
Merge 'no-dashed-invocation' into HEAD
2 parents 646cf41 + d93108a commit c6585c2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

git.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,31 @@ static int run_argv(int *argcp, const char ***argv)
687687
*/
688688
if (!done_alias)
689689
handle_builtin(*argcp, *argv);
690+
else if (get_builtin(**argv)) {
691+
struct argv_array args = ARGV_ARRAY_INIT;
692+
int i;
693+
694+
if (get_super_prefix())
695+
die("%s doesn't support --super-prefix", **argv);
696+
697+
commit_pager_choice();
698+
699+
argv_array_push(&args, "git");
700+
for (i = 0; i < *argcp; i++)
701+
argv_array_push(&args, (*argv)[i]);
702+
703+
trace_argv_printf(args.argv, "trace: exec:");
704+
705+
/*
706+
* if we fail because the command is not found, it is
707+
* OK to return. Otherwise, we just pass along the status code.
708+
*/
709+
i = run_command_v_opt(args.argv, RUN_SILENT_EXEC_FAILURE |
710+
RUN_CLEAN_ON_EXIT);
711+
if (i >= 0 || errno != ENOENT)
712+
exit(i);
713+
die("could not execute builtin %s", **argv);
714+
}
690715

691716
/* .. then try the external ones */
692717
execv_dashed_external(*argv);

0 commit comments

Comments
 (0)