diff options
author | René Scharfe <l.s.r@web.de> | 2022-10-30 12:51:14 +0100 |
---|---|---|
committer | Taylor Blau <me@ttaylorr.com> | 2022-10-30 19:04:40 +0100 |
commit | 0e90673957f12adc1a84b13d3dfff02151e4a7a8 (patch) | |
tree | 737050f737be02089d750d4a291cc65421afc89b /merge.c | |
parent | use child_process member "args" instead of string array variable (diff) | |
download | git-0e90673957f12adc1a84b13d3dfff02151e4a7a8.tar.xz git-0e90673957f12adc1a84b13d3dfff02151e4a7a8.zip |
use child_process members "args" and "env" directly
Build argument list and environment of child processes by using
struct child_process and populating its members "args" and "env"
directly instead of maintaining separate strvecs and letting
run_command_v_opt() and friends populate these members. This is
simpler, shorter and slightly more efficient.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'merge.c')
-rw-r--r-- | merge.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -19,22 +19,22 @@ int try_merge_command(struct repository *r, const char **xopts, struct commit_list *common, const char *head_arg, struct commit_list *remotes) { - struct strvec args = STRVEC_INIT; + struct child_process cmd = CHILD_PROCESS_INIT; int i, ret; struct commit_list *j; - strvec_pushf(&args, "merge-%s", strategy); + strvec_pushf(&cmd.args, "merge-%s", strategy); for (i = 0; i < xopts_nr; i++) - strvec_pushf(&args, "--%s", xopts[i]); + strvec_pushf(&cmd.args, "--%s", xopts[i]); for (j = common; j; j = j->next) - strvec_push(&args, merge_argument(j->item)); - strvec_push(&args, "--"); - strvec_push(&args, head_arg); + strvec_push(&cmd.args, merge_argument(j->item)); + strvec_push(&cmd.args, "--"); + strvec_push(&cmd.args, head_arg); for (j = remotes; j; j = j->next) - strvec_push(&args, merge_argument(j->item)); + strvec_push(&cmd.args, merge_argument(j->item)); - ret = run_command_v_opt(args.v, RUN_GIT_CMD); - strvec_clear(&args); + cmd.git_cmd = 1; + ret = run_command(&cmd); discard_index(r->index); if (repo_read_index(r) < 0) |