Skip to content

Commit 2ca5c4e

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 2b81e2c commit 2ca5c4e

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)