aboutsummaryrefslogtreecommitdiff
path: root/branch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-10-16 23:37:44 -0700
committerJunio C Hamano <gitster@pobox.com>2008-10-17 14:35:06 -0700
commit51a94af845cb3f797abd638478834721d7295af7 (patch)
tree3572e5e0f3b87faabfe998a5c953858757a1328e /branch.c
parent8ed0a740dd42bd0724aebed6e3b07c4ea2a2d5e8 (diff)
downloadgit-51a94af845cb3f797abd638478834721d7295af7.tar.gz
git-51a94af845cb3f797abd638478834721d7295af7.tar.xz
Fix "checkout --track -b newbranch" on detached HEAD
The test to make sure that checkout fails when --track was asked for and we cannot set up tracking information in t7201 was wrong, and it turns out that the implementation for that feature itself was buggy. This fixes it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'branch.c')
-rw-r--r--branch.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/branch.c b/branch.c
index b1e59f219..6a750574f 100644
--- a/branch.c
+++ b/branch.c
@@ -129,7 +129,9 @@ void create_branch(const char *head,
die("Cannot setup tracking information; starting point is not a branch.");
break;
case 1:
- /* Unique completion -- good */
+ /* Unique completion -- good, only if it is a real ref */
+ if (track == BRANCH_TRACK_EXPLICIT && !strcmp(real_ref, "HEAD"))
+ die("Cannot setup tracking information; starting point is not a branch.");
break;
default:
die("Ambiguous object name: '%s'.", start_name);