summaryrefslogtreecommitdiff
path: root/builtin-fetch.c
diff options
context:
space:
mode:
authorKrzysztof Kowalczyk <kkowalczyk@gmail.com>2008-05-10 16:26:58 -0700
committerJunio C Hamano <gitster@pobox.com>2008-05-11 09:04:37 -0700
commit737922aa648c43bc6a61170bee5bfd46ff953f32 (patch)
treeebcdb2c587f0a5b781f0613a711f5501d6b89860 /builtin-fetch.c
parent1f8115b113def8ee03701aa87b26c5e8b7c94434 (diff)
downloadgit-737922aa648c43bc6a61170bee5bfd46ff953f32.tar.gz
alloc_ref_from_str(): factor out a common pattern of alloc_ref from string
Also fix an underallocation in walker.c::interpret_target(). Signed-off-by: Krzysztof Kowalczyk <kkowalczyk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-fetch.c')
-rw-r--r--builtin-fetch.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/builtin-fetch.c b/builtin-fetch.c
index e56617e32e..f6584ecea1 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -508,10 +508,8 @@ static void find_non_local_tags(struct transport *transport,
will_fetch(head, ref->old_sha1))) {
path_list_insert(ref_name, &new_refs);
- rm = alloc_ref(strlen(ref_name) + 1);
- strcpy(rm->name, ref_name);
- rm->peer_ref = alloc_ref(strlen(ref_name) + 1);
- strcpy(rm->peer_ref->name, ref_name);
+ rm = alloc_ref_from_str(ref_name);
+ rm->peer_ref = alloc_ref_from_str(ref_name);
hashcpy(rm->old_sha1, ref_sha1);
**tail = rm;