Code

checkout --ours/--theirs: allow checking out one side of a conflicting merge
[git.git] / t / t7201-co.sh
index 88692f98774bb22f0fb2850b6331e63e8bb65966..c7ae14118a538414c71170516d683a888878a656 100755 (executable)
@@ -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