Skip to content

Commit cb02072

Browse files
dschoGit for Windows Build Agent
authored andcommitted
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 4caf06e commit cb02072

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
@@ -600,6 +600,31 @@ static int run_argv(int *argcp, const char ***argv)
600600
*/
601601
if (!done_alias)
602602
handle_builtin(*argcp, *argv);
603+
else if (get_builtin(**argv)) {
604+
struct argv_array args = ARGV_ARRAY_INIT;
605+
int i;
606+
607+
if (get_super_prefix())
608+
die("%s doesn't support --super-prefix", **argv);
609+
610+
commit_pager_choice();
611+
612+
argv_array_push(&args, "git");
613+
for (i = 0; i < *argcp; i++)
614+
argv_array_push(&args, (*argv)[i]);
615+
616+
trace_argv_printf(args.argv, "trace: exec:");
617+
618+
/*
619+
* if we fail because the command is not found, it is
620+
* OK to return. Otherwise, we just pass along the status code.
621+
*/
622+
i = run_command_v_opt(args.argv, RUN_SILENT_EXEC_FAILURE |
623+
RUN_CLEAN_ON_EXIT);
624+
if (i >= 0 || errno != ENOENT)
625+
exit(i);
626+
die("could not execute builtin %s", **argv);
627+
}
603628

604629
/* .. then try the external ones */
605630
execv_dashed_external(*argv);

0 commit comments

Comments
 (0)