summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-01-16 16:46:16 +0700
committerJunio C Hamano <gitster@pobox.com>2012-01-16 16:26:27 -0800
commit2857093ba15982d21ff0d5a9fd65294ac895cb67 (patch)
tree64b1314c469f9192be5aee4b966d7e0265b8a8f5 /builtin/clone.c
parent5a7d5b683f869d3e3884a89775241afa515da9e7 (diff)
downloadgit-2857093ba15982d21ff0d5a9fd65294ac895cb67.tar.gz
clone: print advice on checking out detached 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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 651b4cc20b..72eebca535 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -563,7 +563,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!"));
}