Skip to content

Commit c47a29c

Browse files
committed
git: avoid calling aliased builtins via their dashed form
This is one of the few places where Git violates its own deprecation of the dashed form. It is not necessary, either. As of 595d59e (git.c: ignore pager.* when launching builtin as dashed external, 2017-08-02), Git wants to ignore the pager.* config setting when expanding aliases. So let's strip out the check_pager_config(<command-name>) call from the copy-edited code. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 32cb636 commit c47a29c

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
@@ -682,6 +682,31 @@ static int run_argv(int *argcp, const char ***argv)
682682
*/
683683
if (!done_alias)
684684
handle_builtin(*argcp, *argv);
685+
else if (get_builtin(**argv)) {
686+
struct argv_array args = ARGV_ARRAY_INIT;
687+
int i;
688+
689+
if (get_super_prefix())
690+
die("%s doesn't support --super-prefix", **argv);
691+
692+
commit_pager_choice();
693+
694+
argv_array_push(&args, "git");
695+
for (i = 0; i < *argcp; i++)
696+
argv_array_push(&args, (*argv)[i]);
697+
698+
trace_argv_printf(args.argv, "trace: exec:");
699+
700+
/*
701+
* if we fail because the command is not found, it is
702+
* OK to return. Otherwise, we just pass along the status code.
703+
*/
704+
i = run_command_v_opt(args.argv, RUN_SILENT_EXEC_FAILURE |
705+
RUN_CLEAN_ON_EXIT);
706+
if (i >= 0 || errno != ENOENT)
707+
exit(i);
708+
die("could not execute builtin %s", **argv);
709+
}
685710

686711
/* .. then try the external ones */
687712
execv_dashed_external(*argv);

0 commit comments

Comments
 (0)