summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-01-16 09:46:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-01-17 00:26:24 (GMT)
commit7f08c6858ecfdf29f9713cf3a0b3699192f01a94 (patch)
treebf7099993b8f41f52ad0c81f9468e6f192a0ca6c /builtin/clone.c
parentbafe763197cb6535e5b4956ffeaa4e26ebb10651 (diff)
downloadgit-7f08c6858ecfdf29f9713cf3a0b3699192f01a94.zip
git-7f08c6858ecfdf29f9713cf3a0b3699192f01a94.tar.gz
git-7f08c6858ecfdf29f9713cf3a0b3699192f01a94.tar.bz2
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>
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 9dcc5fe..91862f7 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -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)