git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/6] t6036: add a failed conflict detection case with submodule modify/modify

From
Elijah Newren <newren@gmail.com>
Date
Jul 1, 2018, 04:11 UTC
Message-ID
<20180701041122.8753-4-newren@gmail.com>
In-Reply-To
<20180701041122.8753-1-newren@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t6036-recursive-corner-cases.sh | 88 +++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)
diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index 0ba04d46d..0c8f81331 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -938,4 +938,92 @@ test_expect_failure 'check symlink add/add' '
 	)
 '
 
+#
+# criss-cross with modify/modify on a submodule:
+#
+#      B   D
+#      o---o
+#     / \ / \
+#  A o   X   ? F
+#     \ / \ /
+#      o---o
+#      C   E
+#
+#   Commit A: simple submodule repo
+#   Commit B: update repo
+#   Commit C: update repo differently
+#   Commit D: merge B&C, resolving in favor of B
+#   Commit E: merge B&C, resolving in favor of C
+#
+# This is an obvious modify/modify conflict for the submodule 'repo'.  Can
+# git detect it?
+
+test_expect_success 'setup submodule modify/modify' '
+	test_create_repo submodule-modify-modify &&
+	(
+		cd submodule-modify-modify &&
+
+		test_create_repo submod &&
+		(
+			cd submod &&
+			touch file-A &&
+			git add file-A &&
+			git commit -m A &&
+			git tag A &&
+
+			git checkout -b B A &&
+			touch file-B &&
+			git add file-B &&
+			git commit -m B &&
+			git tag B &&
+
+			git checkout -b C A &&
+			touch file-C &&
+			git add file-C &&
+			git commit -m C &&
+			git tag C
+		) &&
+
+		git -C submod reset --hard A &&
+		git add submod &&
+		git commit -m A &&
+		git tag A &&
+
+		git checkout -b B A &&
+		git -C submod reset --hard B &&
+		git add submod &&
+		git commit -m B &&
+
+		git checkout -b C A &&
+		git -C submod reset --hard C &&
+		git add submod &&
+		git commit -m C &&
+
+		git checkout -q B^0 &&
+		git merge -s ours -m D C^0 &&
+		git tag D &&
+
+		git checkout -q C^0 &&
+		git merge -s ours -m E B^0 &&
+		git tag E
+	)
+'
+
+test_expect_failure 'check submodule modify/modify' '
+	(
+		cd submodule-modify-modify &&
+
+		git checkout D^0 &&
+
+		test_must_fail git merge -s recursive E^0 &&
+
+		git ls-files -s >out &&
+		test_line_count = 3 out &&
+		git ls-files -u >out &&
+		test_line_count = 3 out &&
+		git ls-files -o >out &&
+		test_line_count = 1 out
+	)
+'
+
 test_done
-- 
2.18.0.130.gd703bbb5d
Previous: Elijah NewrenNext: Elijah Newren
Message 5 of 14 in “Add merge recursive testcases with undetected conflicts”
  1. 0/6 Add merge recursive testcases with undetected conflictsElijah Newren, Jul 1, 2018
  2. 1/6 t6036: add a failed conflict detection case with symlink modify/modifyElijah Newren, Jul 1, 2018
  3. 2/6 t6036: add a failed conflict detection case with symlink add/addElijah Newren, Jul 1, 2018
  4. 4/6 t6036: add a failed conflict detection case with submodule add/addElijah Newren, Jul 1, 2018
  5. 3/6 t6036: add a failed conflict detection case with submodule modify/modifyElijah Newren, Jul 1, 2018
  6. 6/6 t6036: add a failed conflict detection case: regular files, different modesElijah Newren, Jul 1, 2018
  7. 5/6 t6036: add a failed conflict detection case with conflicting typesElijah Newren, Jul 1, 2018
  8. Junio C HamanoJul 9, 2018
  9. Elijah NewrenJul 9, 2018
  10. Jeff KingJul 10, 2018
  11. Elijah NewrenJul 10, 2018
  12. Jeff KingJul 10, 2018
  13. Elijah NewrenJul 11, 2018
  14. Junio C HamanoJul 11, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.