t6036: add a failed conflict detection case with symlink modify/modify
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Jun 30, 2018 at 21:11 UTC
c6d3dd5daf60e7b33d5843bb5dec44fcf852d239
1 file changed
+67
t/t6036-recursive-corner-cases.sh
+67
@@ -805,4 +805,71 @@ test_expect_success 'virtual merge base handles rename/rename(1to2)/add-dest' '
805
)
806
'
807
808
+#
809
+# criss-cross with modify/modify on a symlink:
810
+#
811
+# B D
812
+# o---o
813
+# / \ / \
814
+# A o X ? F
815
+# \ / \ /
816
+# o---o
817
+# C E
818
+#
819
+# Commit A: simple simlink fickle->lagoon
820
+# Commit B: redirect fickle->disneyland
821
+# Commit C: redirect fickle->home
822
+# Commit D: merge B&C, resolving in favor of B
823
+# Commit E: merge B&C, resolving in favor of C
824
+#
825
+# This is an obvious modify/modify conflict for the symlink 'fickle'. Can
826
+# git detect it?
827
+
828
+test_expect_success 'setup symlink modify/modify' '
829
+ test_create_repo symlink-modify-modify &&
830
+ (
831
+ cd symlink-modify-modify &&
832
+
833
+ test_ln_s_add lagoon fickle &&
834
+ git commit -m A &&
835
+ git tag A &&
836
+
837
+ git checkout -b B A &&
838
+ git rm fickle &&
839
+ test_ln_s_add disneyland fickle &&
840
+ git commit -m B &&
841
+
842
+ git checkout -b C A &&
843
+ git rm fickle &&
844
+ test_ln_s_add home fickle &&
845
+ git add fickle &&
846
+ git commit -m C &&
847
+
848
+ git checkout -q B^0 &&
849
+ git merge -s ours -m D C^0 &&
850
+ git tag D &&
851
+
852
+ git checkout -q C^0 &&
853
+ git merge -s ours -m E B^0 &&
854
+ git tag E
855
+ )
856
+'
857
+
858
+test_expect_failure 'check symlink modify/modify' '
859
+ (
860
+ cd symlink-modify-modify &&
861
+
862
+ git checkout D^0 &&
863
+
864
+ test_must_fail git merge -s recursive E^0 &&
865
+
866
+ git ls-files -s >out &&
867
+ test_line_count = 3 out &&
868
+ git ls-files -u >out &&
869
+ test_line_count = 3 out &&
870
+ git ls-files -o >out &&
871
+ test_line_count = 1 out
872
+ )
873
+'
874
+
875
test_done