author | Junio C Hamano <gitster@pobox.com> | |
Mon, 8 Sep 2008 05:44:45 +0000 (22:44 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 8 Sep 2008 05:44:45 +0000 (22:44 -0700) |
* jc/maint-checkout-fix:
checkout: do not check out unmerged higher stages randomly
Conflicts:
t/t7201-co.sh
checkout: do not check out unmerged higher stages randomly
Conflicts:
t/t7201-co.sh
1 | 2 | |||
---|---|---|---|---|
builtin-checkout.c | patch | | diff1 | | diff2 | | blob | history |
t/t7201-co.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc builtin-checkout.c
Simple merge
diff --cc t/t7201-co.sh
index 543b1c289866d01f8aa3f931f3579565a963de9d,83a366f1e7dcbe1d1678cadd87b9862713e82b97..25181388f8a8f1730d05fce128e0e1fc66eb3c0e
--- 1/t/t7201-co.sh
--- 2/t/t7201-co.sh
+++ b/t/t7201-co.sh
test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
test_must_fail git checkout --track -b track'
+test_expect_success \
+ 'checkout with --track fakes a sensible -b <name>' '
+ git update-ref refs/remotes/origin/koala/bear renamer &&
+ git update-ref refs/new/koala/bear renamer &&
+
+ git checkout --track origin/koala/bear &&
+ test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
+ test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
+
+ git checkout master && git branch -D koala/bear &&
+
+ git checkout --track refs/remotes/origin/koala/bear &&
+ test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
+ test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
+
+ git checkout master && git branch -D koala/bear &&
+
+ git checkout --track remotes/origin/koala/bear &&
+ test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
+ test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
+
+ git checkout master && git branch -D koala/bear &&
+
+ git checkout --track refs/new/koala/bear &&
+ test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
+ test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"
+'
+
+test_expect_success \
+ 'checkout with --track, but without -b, fails with too short tracked name' '
+ test_must_fail git checkout --track renamer'
+
+ test_expect_success 'checkout an unmerged path should fail' '
+ rm -f .git/index &&
+ O=$(echo original | git hash-object -w --stdin) &&
+ A=$(echo ourside | git hash-object -w --stdin) &&
+ B=$(echo theirside | git hash-object -w --stdin) &&
+ (
+ echo "100644 $A 0 fild" &&
+ echo "100644 $O 1 file" &&
+ echo "100644 $A 2 file" &&
+ echo "100644 $B 3 file" &&
+ echo "100644 $A 0 filf"
+ ) | git update-index --index-info &&
+ echo "none of the above" >sample &&
+ cat sample >fild &&
+ cat sample >file &&
+ cat sample >filf &&
+ test_must_fail git checkout fild file filf &&
+ test_cmp sample fild &&
+ test_cmp sample filf &&
+ test_cmp sample file
+ '
+
test_done