Skip to content

Commit 20d8006

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 <[email protected]>
1 parent 001e6b9 commit 20d8006

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)