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

[PATCH 3/3] t4301: add a test case involving a rename, type change & modification

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 19, 2022, 06:57 UTC
Message-ID
<3b4ed8bb1bb615277ee51a7b2af5fc53bae0a6e4.1660892256.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1327.git.1660892256.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

This is a reduced version of a real-world scenario that triggered the work on the original file names.

Let's make sure that Git does not regress in that scenario.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t4301-merge-tree-write-tree.sh | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
diff --git a/t/t4301-merge-tree-write-tree.sh b/t/t4301-merge-tree-write-tree.sh
index e08452a8531..3c41ade0a47 100755
--- a/t/t4301-merge-tree-write-tree.sh
+++ b/t/t4301-merge-tree-write-tree.sh
@@ -137,6 +137,38 @@ test_expect_success 'test conflict notices and such' '
 	test_cmp expect actual
 '
 
+test_expect_success SYMLINKS 'original file names and type changes' '
+	git switch --detach side1^ &&
+	test_commit modified whatever &&
+
+	git switch --detach HEAD^ &&
+	git mv whatever wherever &&
+	ln -s wherever whatever &&
+	git add whatever &&
+	test_tick &&
+	git commit -m symlink &&
+	git tag symlink &&
+
+	test_expect_code 1 \
+	git merge-tree -z modified symlink >out &&
+	printf "\\n" >>out &&
+	anonymize_hash out >actual &&
+
+	q_to_tab <<-\EOF | lf_to_nul >expect &&
+	HASH
+	120000 HASH 3Qwhatever
+	100644 HASH 1Qwhatever
+	100644 HASH 2Qwhatever
+
+	EOF
+
+	q_to_nul <<-EOF >>expect &&
+	2QwhateverQwhatever~modifiedQCONFLICT (distinct modes)QCONFLICT (distinct types): whatever had different types on each side; renamed one of them so each can be recorded somewhere.
+	Q
+	EOF
+	test_cmp expect actual
+'
+
 for opt in $(git merge-tree --git-completion-helper-all)
 do
 	if test $opt = "--trivial-merge" || test $opt = "--write-tree"
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadget
Message 12 of 12 in “Show original filenames in merge tree”
  1. 0/3 Show original filenames in merge treeJohannes Schindelin via GitGitGadget, Aug 19, 2022
  2. 1/3 merge-tree -z: always show the original file name firstJohannes Schindelin via GitGitGadget, Aug 19, 2022
  3. Johannes SchindelinAug 19, 2022
  4. Elijah NewrenAug 20, 2022
  5. Elijah NewrenAug 20, 2022
  6. Elijah NewrenAug 21, 2022
  7. Johannes SchindelinAug 22, 2022
  8. Elijah NewrenAug 23, 2022
  9. Johannes SchindelinAug 26, 2022
  10. Elijah NewrenAug 30, 2022
  11. 2/3 merge-tree: show the original file names in the conflict outputJohannes Schindelin via GitGitGadget, Aug 19, 2022
  12. 3/3 t4301: add a test case involving a rename, type change & modificationJohannes Schindelin via GitGitGadget, Aug 19, 2022

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.