@@ -938,4 +938,92 @@ test_expect_failure 'check symlink add/add' '
938
938
)
939
939
'
940
940
941
+ #
942
+ # criss-cross with modify/modify on a submodule:
943
+ #
944
+ # B D
945
+ # o---o
946
+ # / \ / \
947
+ # A o X ? F
948
+ # \ / \ /
949
+ # o---o
950
+ # C E
951
+ #
952
+ # Commit A: simple submodule repo
953
+ # Commit B: update repo
954
+ # Commit C: update repo differently
955
+ # Commit D: merge B&C, resolving in favor of B
956
+ # Commit E: merge B&C, resolving in favor of C
957
+ #
958
+ # This is an obvious modify/modify conflict for the submodule 'repo'. Can
959
+ # git detect it?
960
+
961
+ test_expect_success ' setup submodule modify/modify' '
962
+ test_create_repo submodule-modify-modify &&
963
+ (
964
+ cd submodule-modify-modify &&
965
+
966
+ test_create_repo submod &&
967
+ (
968
+ cd submod &&
969
+ touch file-A &&
970
+ git add file-A &&
971
+ git commit -m A &&
972
+ git tag A &&
973
+
974
+ git checkout -b B A &&
975
+ touch file-B &&
976
+ git add file-B &&
977
+ git commit -m B &&
978
+ git tag B &&
979
+
980
+ git checkout -b C A &&
981
+ touch file-C &&
982
+ git add file-C &&
983
+ git commit -m C &&
984
+ git tag C
985
+ ) &&
986
+
987
+ git -C submod reset --hard A &&
988
+ git add submod &&
989
+ git commit -m A &&
990
+ git tag A &&
991
+
992
+ git checkout -b B A &&
993
+ git -C submod reset --hard B &&
994
+ git add submod &&
995
+ git commit -m B &&
996
+
997
+ git checkout -b C A &&
998
+ git -C submod reset --hard C &&
999
+ git add submod &&
1000
+ git commit -m C &&
1001
+
1002
+ git checkout -q B^0 &&
1003
+ git merge -s ours -m D C^0 &&
1004
+ git tag D &&
1005
+
1006
+ git checkout -q C^0 &&
1007
+ git merge -s ours -m E B^0 &&
1008
+ git tag E
1009
+ )
1010
+ '
1011
+
1012
+ test_expect_failure ' check submodule modify/modify' '
1013
+ (
1014
+ cd submodule-modify-modify &&
1015
+
1016
+ git checkout D^0 &&
1017
+
1018
+ test_must_fail git merge -s recursive E^0 &&
1019
+
1020
+ git ls-files -s >out &&
1021
+ test_line_count = 3 out &&
1022
+ git ls-files -u >out &&
1023
+ test_line_count = 3 out &&
1024
+ git ls-files -o >out &&
1025
+ test_line_count = 1 out
1026
+ )
1027
+ '
1028
+
941
1029
test_done
0 commit comments