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:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-01-17 00:26:27 (GMT)
commit2857093ba15982d21ff0d5a9fd65294ac895cb67 (patch)
tree64b1314c469f9192be5aee4b966d7e0265b8a8f5 /builtin/clone.c
parent5a7d5b683f869d3e3884a89775241afa515da9e7 (diff)
downloadgit-2857093ba15982d21ff0d5a9fd65294ac895cb67.zip
git-2857093ba15982d21ff0d5a9fd65294ac895cb67.tar.gz
git-2857093ba15982d21ff0d5a9fd65294ac895cb67.tar.bz2
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 651b4cc..72eebca 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!"));
}