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

[PATCH v2 06/11] t6422: fix multiple errors with the mod6 test expectations

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 8, 2020, 17:01 UTC
Message-ID
<56e169b1d8e8b24c89f826c3efe7a4d3ca6ade05.1596906081.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.827.v2.git.git.1596906081.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>

This test had multiple issues causing it to fail for the wrong reason(s):

  * rename/rename(1to2) conflicts have always left the original source
    path present in the working directory and index (at stage 1).  Thus,
    the triple rename/rename(1to2) should result in 9 unstaged files,
    not 6.
  * It messed up the three-way content merge for checking the results of
    merging for one of the renames, accidentally turning it into a
    two-way merge.
  * It got the contents of the base files it was using to compare
    against wrong, due to an off-by-one error, and overwrite-redirection
    ('>') instead of append-redirection ('>>').
  * It used slightly too-long conflict markers
  * It didn't include filenames in the conflict marker hunks (granted,
    that was a shortcoming of the merge-recursive backend for rename/add
    and rename/rename(2to1) conflicts, but since it's
    test_expect_failure anyway we might as well make it expect our
    preferred behavior rather than some compromise that we can't yet
    reach anyway).

Fix these issues so that a merge backend which correctly handles these kinds of nested conflicts will pass the test.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t6422-merge-rename-corner-cases.sh | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/t/t6422-merge-rename-corner-cases.sh b/t/t6422-merge-rename-corner-cases.sh
index c8ee033ad9..2413f517e7 100755
--- a/t/t6422-merge-rename-corner-cases.sh
+++ b/t/t6422-merge-rename-corner-cases.sh
@@ -1042,25 +1042,25 @@ test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename
 		test_must_be_empty err &&
 
 		git ls-files -s >file_count &&
-		test_line_count = 6 file_count &&
+		test_line_count = 9 file_count &&
 		git ls-files -u >file_count &&
-		test_line_count = 6 file_count &&
+		test_line_count = 9 file_count &&
 		git ls-files -o >file_count &&
 		test_line_count = 3 file_count &&
 
 		test_seq 10 20 >merged-one &&
 		test_seq 51 60 >merged-five &&
 		# Determine what the merge of three would give us.
-		test_seq 30 40 >three-side-A &&
+		test_seq 31 39 >three-base &&
+		test_seq 31 40 >three-side-A &&
 		test_seq 31 39 >three-side-B &&
-		echo forty >three-side-B &&
-		>empty &&
+		echo forty >>three-side-B &&
 		test_must_fail git merge-file \
-			-L "HEAD" \
+			-L "HEAD:four" \
 			-L "" \
-			-L "B^0" \
-			three-side-A empty three-side-B &&
-		sed -e "s/^\([<=>]\)/\1\1\1/" three-side-A >merged-three &&
+			-L "B^0:two" \
+			three-side-A three-base three-side-B &&
+		sed -e "s/^\([<=>]\)/\1\1/" three-side-A >merged-three &&
 
 		# Verify the index is as expected
 		git rev-parse >actual         \
@@ -1075,6 +1075,7 @@ test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename
 
 		git cat-file -p :2:two >expect &&
 		git cat-file -p :3:two >other &&
+		>empty &&
 		test_must_fail git merge-file    \
 			-L "HEAD"  -L ""  -L "B^0" \
 			expect     empty  other &&
-- 
gitgitgadget
Previous: Elijah Newren via GitGitGadgetNext: Elijah Newren via GitGitGadget
Message 14 of 28 in “Collect merge-related tests to t64xx”
  1. Collect merge-related tests to t64xxElijah Newren via GitGitGadget, Aug 5, 2020
  2. 00/11 Start preparing merge-related tests to work with multiple merge backendsElijah Newren via GitGitGadget, Aug 8, 2020
  3. 02/11 t6418: tighten delete/normalize conflict testcaseElijah Newren via GitGitGadget, Aug 8, 2020
  4. 01/11 Collect merge-related tests to t64xxElijah Newren via GitGitGadget, Aug 8, 2020
  5. 04/11 t6416, t6422: fix incorrect untracked file countElijah Newren via GitGitGadget, Aug 8, 2020
  6. Eric SunshineAug 9, 2020
  7. Elijah NewrenAug 9, 2020
  8. 05/11 t6423: fix test setup for a couple testsElijah Newren via GitGitGadget, Aug 8, 2020
  9. 09/11 t6422, t6426: be more flexible for add/add conflicts involving renamesElijah Newren via GitGitGadget, Aug 8, 2020
  10. 10/11 t642[23]: be more flexible for add/add conflicts involving pair renamesElijah Newren via GitGitGadget, Aug 8, 2020
  11. 08/11 t6423: add an explanation about why one of the tests does not passElijah Newren via GitGitGadget, Aug 8, 2020
  12. 11/11 t6425: be more flexible with rename/delete conflict messagesElijah Newren via GitGitGadget, Aug 8, 2020
  13. 07/11 t6416, t6423: clarify some comments and fix some typosElijah Newren via GitGitGadget, Aug 8, 2020
  14. 06/11 t6422: fix multiple errors with the mod6 test expectationsElijah Newren via GitGitGadget, Aug 8, 2020
  15. 03/11 t6422: fix bad check against missing fileElijah Newren via GitGitGadget, Aug 8, 2020
  16. Eric SunshineAug 9, 2020
  17. 00/11 Start preparing merge-related tests to work with multiple merge backendsElijah Newren via GitGitGadget, Aug 10, 2020
  18. 01/11 Collect merge-related tests to t64xxElijah Newren via GitGitGadget, Aug 10, 2020
  19. 05/11 t6423: fix test setup for a couple testsElijah Newren via GitGitGadget, Aug 10, 2020
  20. 06/11 t6422: fix multiple errors with the mod6 test expectationsElijah Newren via GitGitGadget, Aug 10, 2020
  21. 07/11 t6416, t6423: clarify some comments and fix some typosElijah Newren via GitGitGadget, Aug 10, 2020
  22. 08/11 t6423: add an explanation about why one of the tests does not passElijah Newren via GitGitGadget, Aug 10, 2020
  23. 09/11 t6422, t6426: be more flexible for add/add conflicts involving renamesElijah Newren via GitGitGadget, Aug 10, 2020
  24. 04/11 t6416, t6422: fix incorrect untracked file countElijah Newren via GitGitGadget, Aug 10, 2020
  25. 10/11 t642[23]: be more flexible for add/add conflicts involving pair renamesElijah Newren via GitGitGadget, Aug 10, 2020
  26. 02/11 t6418: tighten delete/normalize conflict testcaseElijah Newren via GitGitGadget, Aug 10, 2020
  27. 11/11 t6425: be more flexible with rename/delete conflict messagesElijah Newren via GitGitGadget, Aug 10, 2020
  28. 03/11 t6422: fix bad check against missing fileElijah Newren via GitGitGadget, Aug 10, 2020

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.