summaryrefslogtreecommitdiff
path: root/merge.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2022-10-30 11:51:14 (GMT)
committerTaylor Blau <me@ttaylorr.com>2022-10-30 18:04:40 (GMT)
commit0e90673957f12adc1a84b13d3dfff02151e4a7a8 (patch)
tree737050f737be02089d750d4a291cc65421afc89b /merge.c
parent4120294cbf8e434c1de408434842d570eba0e25d (diff)
downloadgit-0e90673957f12adc1a84b13d3dfff02151e4a7a8.zip
git-0e90673957f12adc1a84b13d3dfff02151e4a7a8.tar.gz
git-0e90673957f12adc1a84b13d3dfff02151e4a7a8.tar.bz2
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.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/merge.c b/merge.c
index 2382ff6..445b4f1 100644
--- a/merge.c
+++ b/merge.c
@@ -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)