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

[PATCH RFC] Test for apparent regression of merging renamed files

From
Ciaran <ciaranj@gmail.com>
Date
May 2, 2011, 19:04 UTC
Message-ID
<BANLkTimcRbuYzSp+MM-vsvxoWhAS8Jvo8Q@mail.gmail.com>
Provides a test to cover a case that appears to have been regressed out by:
 b2c8c0a762745768e8fb249949801c1aed8f7c1d

At this point no tags contain the above commit, but 'master' does. I'm unsure what is causing the issue, but can see discussion about this fix here:

http://git.661346.n2.nabble.com/BUG-merge-recursive-triggered-quot-BUG-quot-td6179353.html

Providing a patch to demonstrate the issue and spark discussion. --- Whilst working up a patch for my 'whitespace ignorant rename detection' ( http://git.661346.n2.nabble.com/PATCH-RFC-Rename-detection-and-whitespace-td6288524.html ) I was unable to get my tests working, turns out that something that used to work for me, no longer does in master's HEAD.

I don't really understand the fault so I'm throwing it to the list in the hope that someone brighter than me can take it on (I've CC'd the signoff-s to that end! :) Sorry!

 t/t9801-merge-rename.sh |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100755 t/t9801-merge-rename.sh
diff --git a/t/t9801-merge-rename.sh b/t/t9801-merge-rename.sh
new file mode 100755
index 0000000..363911f
--- /dev/null
+++ b/t/t9801-merge-rename.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+test_description='Test for rename merge regression'
+
+. ./test-lib.sh
+
+write_out_files() {
+cat > noformatting.txt << EOF
+if(true){
+// Meaningless
+}
+EOF
+
+cat > formatting.txt << EOF
+	if ( true ) {
+	  // Meaningless
+	}
+EOF
+}
+
+# Test the case where a rename happens in one branch and
+# a whitespace change occurs in a different branch.  The rename
+# change should apply to the whitespace modified file
+test_expect_success setup '
+	write_out_files &&
+	git add formatting.txt &&
+
+	test_tick &&
+	git commit -m Initial &&
+	git checkout -b rename_branch &&
+	git mv formatting.txt formatting_renamed.txt &&
+	git commit -m Rename &&
+	git checkout master &&
+	rm formatting.txt &&
+	mv noformatting.txt formatting.txt &&
+	git commit -a -m Reformat
+'
+test_expect_success 'merge' '
+	git merge rename_branch
+'
+test_done
-- 
1.7.4.1
Next: Ciaran
Message 1 of 3 in “Test for apparent regression of merging renamed files”
  1. Test for apparent regression of merging renamed filesCiaran, May 2, 2011
  2. CiaranMay 3, 2011
  3. Elijah NewrenMay 4, 2011

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.