summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-01-08 18:46:28 +0700
committerJunio C Hamano <gitster@pobox.com>2012-01-08 13:40:42 -0800
commitfe035523b7e03dc75c0ae086d897c9e5e6683624 (patch)
tree9268e29d6e67fb8aafd328921117050645c2b5a1 /builtin/clone.c
parent8c4a37b90815d4e17b2d2e50e9221fd59afd7d23 (diff)
downloadgit-nd/clone-detached.tar.gz
clone: print advice on checking out detached HEADnd/clone-detached
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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 0d4b9abf2e..52596db5da 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -467,7 +467,10 @@ static int checkout(void)
"unable to checkout.\n"));
return 0;
}
- if (strcmp(head, "HEAD")) {
+ if (!strcmp(head, "HEAD")) {
+ if (advice_detached_head)
+ detach_advice(sha1_to_hex(sha1));
+ } else {
if (prefixcmp(head, "refs/heads/"))
die(_("HEAD not found below refs/heads!"));
}