From 51a94af845cb3f797abd638478834721d7295af7 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 16 Oct 2008 23:37:44 -0700 Subject: 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 --- branch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'branch.c') diff --git a/branch.c b/branch.c index b1e59f2196..6a750574fd 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); -- cgit v1.2.1