[RFC/PATCH 09/18] Add testcase for --index-only merges with the ours strategy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is almost trivial to make work, because we already know that the
working tree will need no modifications, but lets test it for completeness
anyway.

Signed-off-by: Elijah Newren <newren@xxxxxxxxx>
---
 t/t6043-merge-index-only.sh | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/t/t6043-merge-index-only.sh b/t/t6043-merge-index-only.sh
index b01bf79..84c6640 100755
--- a/t/t6043-merge-index-only.sh
+++ b/t/t6043-merge-index-only.sh
@@ -374,4 +374,36 @@ test_expect_failure '--index-only octopus, bare' '
 	)
 '
 
+test_expect_failure '--index-only ours, non-bare' '
+	git reset --hard &&
+	git checkout B^0 &&
+
+	git merge --index-only -s ours C^0 &&
+
+	test "$(git rev-list --count HEAD)" -eq 4 &&
+	test $(git rev-parse :a) = $(git rev-parse B:a) &&
+	test $(git rev-parse :b) = $(git rev-parse B:b) &&
+	test_must_fail git rev-parse :c &&
+	test ! -f c
+'
+
+test_expect_failure '--index-only ours, bare' '
+	rm -rf bare.clone &&
+	git clone --bare . bare.clone &&
+	(cd bare.clone &&
+
+	 git update-ref --no-deref HEAD B &&
+	 git read-tree HEAD &&
+
+	 git merge --index-only -s ours C^0 &&
+
+	 test "$(git rev-list --count HEAD)" -eq 4 &&
+	 test $(git rev-parse :a) = $(git rev-parse B:a) &&
+	 test $(git rev-parse :b) = $(git rev-parse B:b) &&
+	 test_must_fail git rev-parse :c &&
+	 test ! -f a &&
+	 test ! -f c
+	)
+'
+
 test_done
-- 
2.8.0.18.gc685494

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]