summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-08-12 09:47:36 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-08-12 09:47:36 -0700
commit18f3ce8841b1cf7a3bee8e8da75fd7520060a4c0 (patch)
tree987dec480980f53bf1ddec5ecb4be3d32db6eb6e /builtin
parentMerge branch 'js/import-tars-hardlinks' (diff)
parentuse CHILD_PROCESS_INIT to initialize automatic variables (diff)
downloadtgif-18f3ce8841b1cf7a3bee8e8da75fd7520060a4c0.tar.xz
Merge branch 'rs/child-process-init'
A small code clean-up. * rs/child-process-init: use CHILD_PROCESS_INIT to initialize automatic variables
Diffstat (limited to 'builtin')
-rw-r--r--builtin/submodule--helper.c3
-rw-r--r--builtin/worktree.c6
2 files changed, 3 insertions, 6 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 343d25b758..e79790f0bd 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -444,8 +444,7 @@ static int module_name(int argc, const char **argv, const char *prefix)
static int clone_submodule(const char *path, const char *gitdir, const char *url,
const char *depth, const char *reference, int quiet)
{
- struct child_process cp;
- child_process_init(&cp);
+ struct child_process cp = CHILD_PROCESS_INIT;
argv_array_push(&cp.args, "clone");
argv_array_push(&cp.args, "--no-checkout");
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 5a41788edb..6dcf7bd9d2 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -194,7 +194,7 @@ static int add_worktree(const char *path, const char *refname,
struct strbuf sb = STRBUF_INIT;
const char *name;
struct stat st;
- struct child_process cp;
+ struct child_process cp = CHILD_PROCESS_INIT;
struct argv_array child_env = ARGV_ARRAY_INIT;
int counter = 0, len, ret;
struct strbuf symref = STRBUF_INIT;
@@ -273,7 +273,6 @@ static int add_worktree(const char *path, const char *refname,
argv_array_pushf(&child_env, "%s=%s", GIT_DIR_ENVIRONMENT, sb_git.buf);
argv_array_pushf(&child_env, "%s=%s", GIT_WORK_TREE_ENVIRONMENT, path);
- memset(&cp, 0, sizeof(cp));
cp.git_cmd = 1;
if (commit)
@@ -365,8 +364,7 @@ static int add(int ac, const char **av, const char *prefix)
}
if (opts.new_branch) {
- struct child_process cp;
- memset(&cp, 0, sizeof(cp));
+ struct child_process cp = CHILD_PROCESS_INIT;
cp.git_cmd = 1;
argv_array_push(&cp.args, "branch");
if (opts.force_new_branch)