提交 a17062cf 编写于 作者: S Stefan Beller 提交者: Junio C Hamano

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: NStefan Beller <sbeller@google.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 d2bbb7c2
...@@ -1468,15 +1468,15 @@ int submodule_move_head(const char *path, ...@@ -1468,15 +1468,15 @@ int submodule_move_head(const char *path,
if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) { if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
if (new) { if (new) {
struct child_process cp1 = CHILD_PROCESS_INIT; child_process_init(&cp);
/* also set the HEAD accordingly */ /* also set the HEAD accordingly */
cp1.git_cmd = 1; cp.git_cmd = 1;
cp1.no_stdin = 1; cp.no_stdin = 1;
cp1.dir = path; cp.dir = path;
argv_array_pushl(&cp1.args, "update-ref", "HEAD", new, NULL); argv_array_pushl(&cp.args, "update-ref", "HEAD", new, NULL);
if (run_command(&cp1)) { if (run_command(&cp)) {
ret = -1; ret = -1;
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册