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

Re: [PATCH] 3-way merge with file move fails when diff.renames = copies

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 11, 2008, 00:15 UTC
Message-ID
<7vwsfb2k3u.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7v63mv3zww.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> "David D. Kilzer" <ddkilzer@kilzer.net> writes:
>
>> With diff.renames = copies, a 3-way merge (e.g. "git rebase") would
>> fail with the following error:

By the way, I think the real issue with this one is that we currently do not disable diff.renames configuration while rebase internally runs "format-patch" to feed "am -3".

The end user configuration for "diff" should not affect the result produced by the higher level command that is related to "diff" only because internally it is implemented in terms of it.

For that matter, I have a feeling that format-patch should not even look at diff.renames, but we seem to have been doing this for a long time so there is no easy way to fix this thinko.

In any case, here is a much straightforward fix for "rebase".  

Running "am -3" on a copying patch would still need a patch to the index-info codepath, and my earlier comment on it still stands, but it is irrelevant/orthogonal to your particular test script.

 git-rebase.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git c/git-rebase.sh w/git-rebase.sh
index 023a6dc..159ccb3 100755
--- c/git-rebase.sh
+++ w/git-rebase.sh
@@ -429,7 +429,7 @@ fi
 if test -z "$do_merge"
 then
 	git format-patch -k --stdout --full-index --ignore-if-in-upstream \
-		"$upstream..$orig_head" |
+		--no-renames "$upstream..$orig_head" |
 	git am $git_am_opt --rebasing --resolvemsg="$RESOLVEMSG" &&
 	move_to_original_branch
 	ret=$?
Previous: David D. KilzerNext: David D. Kilzer
Message 6 of 22 in “3-way merge with file move fails when diff.renames = copies”
  1. 3-way merge with file move fails when diff.renames = copiesDavid D. Kilzer, Nov 10, 2008
  2. Johannes SchindelinNov 10, 2008
  3. Fix 3-way merge with file move when diff.renames = copiesDavid D. Kilzer, Nov 10, 2008
  4. Junio C HamanoNov 10, 2008
  5. David D. KilzerNov 11, 2008
  6. Junio C HamanoNov 11, 2008
  7. Fix rebase with file move when diff.renames = copiesDavid D. Kilzer, Jul 21, 2010
  8. Junio C HamanoJul 21, 2010
  9. David D. KilzerJul 22, 2010
  10. Jonathan NiederJul 22, 2010
  11. David D. KilzerJul 22, 2010
  12. 0/5 Fix rebase with file move when diff.renames = copiesJonathan Nieder, Jul 23, 2010
  13. 1/5 t4150 (am): style tweaksJonathan Nieder, Jul 23, 2010
  14. 2/5 t4150 (am): futureproof against failing testsJonathan Nieder, Jul 23, 2010
  15. 3/5 Teach "apply --index-info" to handle rename patchesJonathan Nieder, Jul 23, 2010
  16. 4/5 t3400 (rebase): whitespace cleanupJonathan Nieder, Jul 23, 2010
  17. 5/5 rebase: protect against diff.renames configurationJonathan Nieder, Jul 23, 2010
  18. Sverre RabbelierJul 23, 2010
  19. Junio C HamanoJul 23, 2010
  20. Sverre RabbelierJul 23, 2010
  21. David D. KilzerJul 23, 2010
  22. Jonathan NiederJul 24, 2010

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.