Merge branch 'mz/empty-rebase-test'
[gitweb.git] / builtin / clone.c
index 7f3b9823ce4e2ff911acca4d1632e7310e8e0aeb..d3b7fdccecb7a368b4931d3a8c6ea0483509dccc 100644 (file)
@@ -433,8 +433,11 @@ static struct ref *wanted_peer_refs(const struct ref *refs,
 
                if (!option_branch)
                        remote_head = guess_remote_head(head, refs, 0);
-               else
-                       remote_head = find_remote_branch(refs, option_branch);
+               else {
+                       local_refs = NULL;
+                       tail = &local_refs;
+                       remote_head = copy_ref(find_remote_branch(refs, option_branch));
+               }
 
                if (!remote_head && option_branch)
                        warning(_("Could not find remote branch %s to clone."),