submodule_move_head: reuse child_process structure for futher commands
We do not need to declare another struct child_process, but we can just reuse the existing `cp` struct. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
May 2, 2017 at 12:32 UTC
a17062cf42556593fb73547e613b0be867026257
1 file changed
+6
-6
submodule.c
+6
-6
@@ -1468,15 +1468,15 @@ int submodule_move_head(const char *path,
1468
1469
if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
1470
if (new) {
1471
- struct child_process cp1 = CHILD_PROCESS_INIT;
1471
+ child_process_init(&cp);
1472
/* also set the HEAD accordingly */
1473
- cp1.git_cmd = 1;
1474
- cp1.no_stdin = 1;
1475
- cp1.dir = path;
1473
+ cp.git_cmd = 1;
1474
+ cp.no_stdin = 1;
1475
+ cp.dir = path;
1476
1477
- argv_array_pushl(&cp1.args, "update-ref", "HEAD", new, NULL);
1477
+ argv_array_pushl(&cp.args, "update-ref", "HEAD", new, NULL);
1478
1479
- if (run_command(&cp1)) {
1479
+ if (run_command(&cp)) {
1480
ret = -1;
1481
goto out;
1482
}