summaryrefslogtreecommitdiff
path: root/builtin-clone.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-clone.c')
-rw-r--r--builtin-clone.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/builtin-clone.c b/builtin-clone.c
index 49d2eb9..1ddc14b 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -264,10 +264,9 @@ pid_t junk_pid;
static void remove_junk(void)
{
- struct strbuf sb;
+ struct strbuf sb = STRBUF_INIT;
if (getpid() != junk_pid)
return;
- strbuf_init(&sb, 0);
if (junk_git_dir) {
strbuf_addstr(&sb, junk_git_dir);
remove_dir_recursively(&sb, 0);
@@ -354,7 +353,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
char *path, *dir;
const struct ref *refs, *head_points_at, *remote_head, *mapped_refs;
char branch_top[256], key[256], value[256];
- struct strbuf reflog_msg;
+ struct strbuf reflog_msg = STRBUF_INIT;
struct transport *transport = NULL;
char *src_ref_prefix = "refs/heads/";
@@ -404,7 +403,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (!stat(dir, &buf))
die("destination directory '%s' already exists.", dir);
- strbuf_init(&reflog_msg, 0);
strbuf_addf(&reflog_msg, "clone: from %s", repo);
if (option_bare)
@@ -526,7 +524,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
create_symref("HEAD", head_points_at->name, NULL);
if (!option_bare) {
- struct strbuf head_ref;
+ struct strbuf head_ref = STRBUF_INIT;
const char *head = head_points_at->name;
if (!prefixcmp(head, "refs/heads/"))
@@ -539,7 +537,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
head_points_at->old_sha1,
NULL, 0, DIE_ON_ERR);
- strbuf_init(&head_ref, 0);
strbuf_addstr(&head_ref, branch_top);
strbuf_addstr(&head_ref, "HEAD");