aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-30 07:46:55 -0700
committerJunio C Hamano <gitster@pobox.com>2008-08-30 19:16:12 -0700
commitdb9410990ee41f2b253763621c0023c782ec86e2 (patch)
tree59a1b964e8437f0a06e9a4f2bbcb638849f18e2b /t
parent8fdcf3125465f70c0cad5be5ab192d46e46307c7 (diff)
downloadgit-db9410990ee41f2b253763621c0023c782ec86e2.tar.gz
git-db9410990ee41f2b253763621c0023c782ec86e2.tar.xz
checkout -f: allow ignoring unmerged paths when checking out of the index
Earlier we made "git checkout $pathspec" to atomically refuse the operation of $pathspec matched any path with unmerged stages. This patch allows: $ git checkout -f a b c to ignore, instead of error out on, such unmerged paths. The fix to prevent checkout of an unmerged path from random stages is still there. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t7201-co.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 83a366f1e..88692f987 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -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