clone: write detached HEAD in bare repositories
If we don't write, HEAD is still at refs/heads/master as initialized by init-db, which may or may not match remote's HEAD. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
bafe763197
commit
7f08c6858e
@ -764,12 +764,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
} else if (remote_head) {
|
||||
/* Source had detached HEAD pointing somewhere. */
|
||||
if (!option_bare) {
|
||||
update_ref(reflog_msg.buf, "HEAD",
|
||||
remote_head->old_sha1,
|
||||
NULL, REF_NODEREF, DIE_ON_ERR);
|
||||
our_head_points_at = remote_head;
|
||||
}
|
||||
update_ref(reflog_msg.buf, "HEAD", remote_head->old_sha1,
|
||||
NULL, REF_NODEREF, DIE_ON_ERR);
|
||||
our_head_points_at = remote_head;
|
||||
} else {
|
||||
/* Nothing to checkout out */
|
||||
if (!option_no_checkout)
|
||||
|
Reference in New Issue
Block a user