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>
This commit is contained in:
Junio C Hamano
2008-10-16 23:37:44 -07:00
parent 8ed0a740dd
commit 51a94af845
2 changed files with 11 additions and 7 deletions

View File

@ -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);