summaryrefslogtreecommitdiff
path: root/t/t7201-co.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-30 07:48:18 -0700
committerJunio C Hamano <gitster@pobox.com>2008-08-30 19:28:45 -0700
commit38901a48375952ab6c02f22bddfa19ac2bec2c36 (patch)
treee92bde1bc110e1456cd9980bce0ea80f49dae902 /t/t7201-co.sh
parentdb9410990ee41f2b253763621c0023c782ec86e2 (diff)
downloadgit-38901a48375952ab6c02f22bddfa19ac2bec2c36.tar.gz
checkout --ours/--theirs: allow checking out one side of a conflicting merge
This lets you to check out 'our' (or 'their') version of an unmerged path out of the index while resolving conflicts. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7201-co.sh')
-rwxr-xr-xt/t7201-co.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 88692f9877..c7ae14118a 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -382,4 +382,29 @@ test_expect_success 'checkout with an unmerged path can be ignored' '
test_cmp sample file
'
+test_expect_success 'checkout unmerged stage' '
+ 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 &&
+ echo ourside >expect &&
+ cat sample >fild &&
+ cat sample >file &&
+ cat sample >filf &&
+ git checkout --ours . &&
+ test_cmp expect fild &&
+ test_cmp expect filf &&
+ test_cmp expect file &&
+ git checkout --theirs file &&
+ test ztheirside = "z$(cat file)"
+'
+
test_done