Skip to content

Commit 0e06dae

Browse files
committed
Merge 'no-dashed-invocation' into HEAD
2 parents 5f2baf0 + 20d8006 commit 0e06dae

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
@@ -698,6 +698,31 @@ static int run_argv(int *argcp, const char ***argv)
698698
*/
699699
if (!done_alias)
700700
handle_builtin(*argcp, *argv);
701+
else if (get_builtin(**argv)) {
702+
struct argv_array args = ARGV_ARRAY_INIT;
703+
int i;
704+
705+
if (get_super_prefix())
706+
die("%s doesn't support --super-prefix", **argv);
707+
708+
commit_pager_choice();
709+
710+
argv_array_push(&args, "git");
711+
for (i = 0; i < *argcp; i++)
712+
argv_array_push(&args, (*argv)[i]);
713+
714+
trace_argv_printf(args.argv, "trace: exec:");
715+
716+
/*
717+
* if we fail because the command is not found, it is
718+
* OK to return. Otherwise, we just pass along the status code.
719+
*/
720+
i = run_command_v_opt(args.argv, RUN_SILENT_EXEC_FAILURE |
721+
RUN_CLEAN_ON_EXIT);
722+
if (i >= 0 || errno != ENOENT)
723+
exit(i);
724+
die("could not execute builtin %s", **argv);
725+
}
701726

702727
/* .. then try the external ones */
703728
execv_dashed_external(*argv);

0 commit comments

Comments
 (0)