[PATCH] git: run alias subprocess according to the API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Kristoffer Haugsbakk <code@xxxxxxxxxxxxxxx>

`run-command.h` tells us that this is how we should run git(1) commands.

Signed-off-by: Kristoffer Haugsbakk <code@xxxxxxxxxxxxxxx>
---

Notes (series):
    From: https://lore.kernel.org/git/a8874cde-cd00-41b0-ba41-ab2fd52ce45d@xxxxxxxx/T/#m2667cc5ffed44fb7b73d349b1e6dba281e3e0384
    
    The alias question.
    
    But we just end up running what is named `git`.  So it has no bearing on
    that question.
    
    § Code spelunking
    
    I traced the push-`git`-to-command code back to `argv_array_push(&args,
    "git");` which lead me back to ee4512ed481 (trace2: create new combined
    trace facility, 2019-02-22).  It didn’t look relevant.
    
    § Other code
    
    The only other thing I found was in `upload-pack.c`.
    
        strvec_push(&pack_objects.args, "git");
    
    But that one is intentional; this is inside an else-block and the
    if-block has `pack_objects.git_cmd = 1;`.  And attempts to refactor it
    broke `t5544-pack-objects-hook.sh`.

 git.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git.c b/git.c
index d020eef021c..f16a8fbb55d 100644
--- a/git.c
+++ b/git.c
@@ -825,18 +825,18 @@ static int run_argv(struct strvec *args)
 			 * process will log the actual verb when it runs.
 			 */
 			trace2_cmd_name("_run_git_alias_");
 
 			commit_pager_choice();
 
-			strvec_push(&cmd.args, "git");
 			for (size_t i = 0; i < args->nr; i++)
 				strvec_push(&cmd.args, args->v[i]);
 
 			trace_argv_printf(cmd.args.v, "trace: exec:");
 
+			cmd.git_cmd = 1;
 			/*
 			 * if we fail because the command is not found, it is
 			 * OK to return. Otherwise, we just pass along the status code.
 			 */
 			cmd.silent_exec_failure = 1;
 			cmd.clean_on_exit = 1;

base-commit: ab427cd991100e94792fce124b0934135abdea4b
-- 
2.51.0.16.gcd94ab5bf81





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux