Skip to content

Commit ef3bf74

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 2cefdd6 commit ef3bf74

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
@@ -742,6 +742,31 @@ static int run_argv(int *argcp, const char ***argv)
742742
*/
743743
if (!done_alias)
744744
handle_builtin(*argcp, *argv);
745+
else if (get_builtin(**argv)) {
746+
struct argv_array args = ARGV_ARRAY_INIT;
747+
int i;
748+
749+
if (get_super_prefix())
750+
die("%s doesn't support --super-prefix", **argv);
751+
752+
commit_pager_choice();
753+
754+
argv_array_push(&args, "git");
755+
for (i = 0; i < *argcp; i++)
756+
argv_array_push(&args, (*argv)[i]);
757+
758+
trace_argv_printf(args.argv, "trace: exec:");
759+
760+
/*
761+
* if we fail because the command is not found, it is
762+
* OK to return. Otherwise, we just pass along the status code.
763+
*/
764+
i = run_command_v_opt(args.argv, RUN_SILENT_EXEC_FAILURE |
765+
RUN_CLEAN_ON_EXIT);
766+
if (i >= 0 || errno != ENOENT)
767+
exit(i);
768+
die("could not execute builtin %s", **argv);
769+
}
745770

746771
#if 0 // TODO In GFW, need to amend a7924b655e940b06cb547c235d6bed9767929673 to include trace2_ and _tr2 lines.
747772
else if (get_builtin(**argv)) {

0 commit comments

Comments
 (0)