summaryrefslogtreecommitdiffstats
path: root/branch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-10-17 08:37:44 +0200
committerJunio C Hamano <gitster@pobox.com>2008-10-17 23:35:06 +0200
commit51a94af845cb3f797abd638478834721d7295af7 (patch)
tree3572e5e0f3b87faabfe998a5c953858757a1328e /branch.c
parentt1301-shared-repo.sh: don't let a default ACL interfere with the test (diff)
downloadgit-51a94af845cb3f797abd638478834721d7295af7.tar.xz
git-51a94af845cb3f797abd638478834721d7295af7.zip
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 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);