summaryrefslogtreecommitdiff
path: root/builtin-clone.c
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2008-11-21 01:44:59 +0100
committerJunio C Hamano <gitster@pobox.com>2008-11-25 15:34:25 -0800
commit32716a2c6c238113c9a5af116e5ab6f3f4ecde8d (patch)
tree5c4b985623ec2deadcb7b4e52250a63791758c86 /builtin-clone.c
parent6fc4a7e546d5e2b0ce545f73b5c1829887db2462 (diff)
downloadgit-32716a2c6c238113c9a5af116e5ab6f3f4ecde8d.tar.gz
builtin-clone: use strbuf in guess_dir_name()
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-clone.c')
-rw-r--r--builtin-clone.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin-clone.c b/builtin-clone.c
index 8e1a1d3995..275b690b3c 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -134,9 +134,9 @@ static char *guess_dir_name(const char *repo, int is_bundle, int is_bare)
}
if (is_bare) {
- char *result = xmalloc(end - start + 5);
- sprintf(result, "%.*s.git", (int)(end - start), start);
- return result;
+ struct strbuf result = STRBUF_INIT;
+ strbuf_addf(&result, "%.*s.git", (int)(end - start), start);
+ return strbuf_detach(&result, 0);
}
return xstrndup(start, end - start);