Code

checkout -f: allow ignoring unmerged paths when checking out of the index
[git.git] / t / t7201-co.sh
index 83a366f1e7dcbe1d1678cadd87b9862713e82b97..88692f98774bb22f0fb2850b6331e63e8bb65966 100755 (executable)
@@ -359,4 +359,27 @@ test_expect_success 'checkout an unmerged path should fail' '
        test_cmp sample file
 '
 
+test_expect_success 'checkout with an unmerged path can be ignored' '
+       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 -f fild file filf &&
+       test_cmp expect fild &&
+       test_cmp expect filf &&
+       test_cmp sample file
+'
+
 test_done