diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-10-16 23:37:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-10-17 14:35:06 -0700 |
commit | 51a94af845cb3f797abd638478834721d7295af7 (patch) | |
tree | 3572e5e0f3b87faabfe998a5c953858757a1328e /branch.c | |
parent | 8ed0a740dd42bd0724aebed6e3b07c4ea2a2d5e8 (diff) | |
download | git-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.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); |