summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8ed0a74)
raw | patch | inline | side by side (parent: 8ed0a74)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 17 Oct 2008 06:37:44 +0000 (23:37 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 17 Oct 2008 21:35:06 +0000 (14:35 -0700) |
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>
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>
branch.c | patch | blob | history | |
t/t7201-co.sh | patch | blob | history |
diff --git a/branch.c b/branch.c
index b1e59f2196b933ab7169a30efc5d1d340f8f9c5c..6a750574fd376e4d54e4ef2576674d42521f1529 100644 (file)
--- a/branch.c
+++ b/branch.c
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);
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index fbec70d3c6abff4a97aa205aa10fbf6fe336fa5f..ee2cab6bb2162e4060227adae82d742d6677cf1a 100755 (executable)
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
test "$(git config branch.track2.merge)"
git config branch.autosetupmerge false'
-test_expect_success \
- 'checkout w/--track from non-branch HEAD fails' '
- git checkout -b delete-me master &&
- rm .git/refs/heads/delete-me &&
- test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
- test_must_fail git checkout --track -b track'
+test_expect_success 'checkout w/--track from non-branch HEAD fails' '
+ git checkout master^0 &&
+ test_must_fail git symbolic-ref HEAD &&
+ test_must_fail git checkout --track -b track &&
+ test_must_fail git rev-parse --verify track &&
+ test_must_fail git symbolic-ref HEAD &&
+ test "z$(git rev-parse master^0)" = "z$(git rev-parse HEAD)"
+'
test_expect_success 'checkout an unmerged path should fail' '
rm -f .git/index &&