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

[PATCH 2/4] t6038: fix test with obviously incorrect expectations

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 2, 2020, 06:33 UTC
Message-ID
<83a50f7e0bbfd19cffc5cffb9f17484e86443d0a.1596349986.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.825.git.git.1596349986.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>

t6038.11, 'cherry-pick patch from after text=auto' was set up so that on a branch with no .gitattributes file, you cherry-picked a patch from a branch that had a .gitattributes file (containing '* text=auto'). Further, the two branches had a file which differed only in line endings. In this situation, correct behavior is not well defined: should the .gitattributes file affect the merge or not?

If the .gitattributes file on the other branch should not affect the merge, then we would have a content conflict with all three stages different (the merge base didn't match either side).

If the .gitattributes file from the other branch should affect the merge, then we would expect the line endings to be normalized to LF so that the versions from both sides match, and then the cherry-pick has no conflicts and can succeed. After the cherry-pick, the line endings in the file will change from CRLF to LF.

This test had an expectation that the line endings would remain CRLF. Further, it expected an error message that was built assuming cherry-pick was the old scripted version, because cherry-pick no longer uses the error message that was encoded in this test. So, although I don't know what correct behavior for this test is, I know that this test was not testing for it.

Since I have no idea which of the two cases above provides correct behavior, let's just assume for now it's the case where we assume that .gitattributes affects the merge and update it accordingly.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t6038-merge-text-auto.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/t/t6038-merge-text-auto.sh b/t/t6038-merge-text-auto.sh
index 27cea15533..39413d5b48 100755
--- a/t/t6038-merge-text-auto.sh
+++ b/t/t6038-merge-text-auto.sh
@@ -189,7 +189,7 @@ test_expect_failure 'checkout -m addition of text=auto' '
 '
 
 test_expect_failure 'cherry-pick patch from after text=auto was added' '
-	append_cr <<-\EOF >expected &&
+	cat <<-\EOF >expected &&
 	first line
 	same line
 	EOF
@@ -197,9 +197,9 @@ test_expect_failure 'cherry-pick patch from after text=auto was added' '
 	git config merge.renormalize true &&
 	git rm -fr . &&
 	git reset --hard b &&
-	test_must_fail git cherry-pick a >err 2>&1 &&
-	grep "[Nn]othing added" err &&
-	compare_files expected file
+	git cherry-pick a &&
+	git cat-file -p HEAD:file >actual &&
+	compare_files expected actual
 '
 
 test_expect_success 'Test delete/normalize conflict' '
-- 
gitgitgadget
Previous: Elijah Newren via GitGitGadgetNext: Junio C Hamano
Message 10 of 18 in “Attr fixes”
  1. 0/4 Attr fixesElijah Newren via GitGitGadget, Aug 2, 2020
  2. 1/4 t6038: make tests fail for the right reasonElijah Newren via GitGitGadget, Aug 2, 2020
  3. Junio C HamanoAug 2, 2020
  4. Eric SunshineAug 2, 2020
  5. Elijah NewrenAug 3, 2020
  6. 3/4 merge: make merge.renormalize work for all uses of merge machineryElijah Newren via GitGitGadget, Aug 2, 2020
  7. Junio C HamanoAug 2, 2020
  8. Elijah NewrenAug 3, 2020
  9. 4/4 checkout: support renormalization with checkout -m <paths>Elijah Newren via GitGitGadget, Aug 2, 2020
  10. 2/4 t6038: fix test with obviously incorrect expectationsElijah Newren via GitGitGadget, Aug 2, 2020
  11. Junio C HamanoAug 2, 2020
  12. Elijah NewrenAug 3, 2020
  13. Junio C HamanoAug 3, 2020
  14. 0/4 Attr fixesElijah Newren via GitGitGadget, Aug 3, 2020
  15. 1/4 t6038: make tests fail for the right reasonElijah Newren via GitGitGadget, Aug 3, 2020
  16. 4/4 checkout: support renormalization with checkout -m <paths>Elijah Newren via GitGitGadget, Aug 3, 2020
  17. 2/4 t6038: remove problematic testElijah Newren via GitGitGadget, Aug 3, 2020
  18. 3/4 merge: make merge.renormalize work for all uses of merge machineryElijah Newren via GitGitGadget, Aug 3, 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.