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

Re: Merging limitations after directory renames -- interesting test repo

From
Jeff King <peff@peff.net>
Date
Feb 18, 2011, 22:21 UTC
Message-ID
<20110218222151.GB4258@sigill.intra.peff.net>
In-Reply-To
<AANLkTimsQmOLDENX27YqpicBeFFZrfgEAsLvFiJqoV7w@mail.gmail.com>
[cc'ing Linus, who is usually interested in deep rename issues]
On Fri, Feb 18, 2011 at 01:58:48PM -0500, Martin Langhoff wrote:
> Fetch git://dev.laptop.org/git/users/martin/etherpad and try to merge
> pg and master. A ton of work is left to do by hand, and you don't even
s{git/}{} in your url.
>  - Many paths that shoud succeed don't seem to succeed.
Hmm. Two questions:
  1. Did you bump up your merge.renamelimit? It's hard to see because it
     scrolls off the screen amidst the many conflicts, but the first
     message is:
       warning: too many files (created: 425 deleted: 1093), skipping
       inexact rename detection
     which you want to use. Try "git config merge.renamelimit
     10000". Which runs pretty snappily on my machine; I wonder if we
     should up the default limit.
  2. Which version of git are you using? Commit 83c9031 produces some
     funky results on merges. It's not in any released version of git,
     but it is in master.
Show 6 quoted lines
> After using git merge, tell me if this file doesn't look like at least
> git should have _attempted_ a diff3 on it:
>
>    gitk --all  -- etherpad/bin/rebuildjar.sh
>    trunk/etherpad/bin/rebuildjar.sh
>    trunk/trunk/etherpad/bin/rebuildjar.sh
So assuming the two issues above are not a problem, merge says:
  CONFLICT (rename/delete): Rename
  trunk/etherpad/bin/rebuildjar.sh->etherpad/bin/rebuildjar.sh in
  origin/pg and deleted in HEAD

about this and many other files. But that doesn't seem right. Both sides did the same rename. But we don't seem to detect it on "master":

  $ base=`git merge-base master origin/pg`
  $ git diff -M --summary $base master | grep rebuildjar
   create mode 100755 etherpad/bin/rebuildjar.sh
   delete mode 100755 trunk/etherpad/bin/rebuildjar.sh
Hmm. That is probably because it was substantially rewritten:
  $ wc -l etherpad/bin/rebuildjar.sh
  161
  $ git diff --stat \
      $base:trunk/etherpad/bin/rebuildjar.sh \
      master:etherpad/bin/rebuildjar.sh
   .../etherpad => master:etherpad}/bin/rebuildjar.sh |   92 +++++++++++++-
   1 files changed, 89 insertions(+), 3 deletions(-)

You can ignore the rename-looking bit in the diffstat; it's an artifact of the way single-blob diffs are done. But the important thing to note is that it was mostly rewritten on the master branch, and that's why the rename isn't found.

This seems like an interesting case with respect to git's philosophy of automatic rename detection. Usually the notion of "if it is so far apart that we can't do rename detection, a 3-way merge is not likely to be interesting" works.

But in this case, that may not hold. We have identical renames on either side, but one side has been modified a lot. The 3-way merge may very well be useful, but we never get there, because we don't even consider that the two endpoints may be related.

You can simulate the 3-way merge that would happen with:
  $ git show origin/pg:etherpad/bin/rebuildjar.sh >pg
  $ git show master:etherpad/bin/rebuildjar.sh >master
  $ git show $base:trunk/etherpad/bin/rebuildjar.sh >base
  $ git merge-file master base pg
  $ $EDITOR master

It's an ugly merge, but way more useful than dumping with a rename/delete conflict.

I'm not sure of the right solution. I guess if there was some way to say "no really, these are renames" it would make your merge easier. But I wonder if we can somehow be more clever.

>  - Git diff seems confused, says "path needs merge" instead of giving
> me a diff. May be related to the first problem
>     git diff -- etherpad/bin/rebuildjar.sh

I think this is a side effect of the rename/delete conflict. There is nothing to diff against on one side.

-Peff
Previous: Martin LanghoffNext: Linus Torvalds
Message 2 of 34 in “Merging limitations after directory renames -- interesting test repo”
  1. Martin LanghoffFeb 18, 2011
  2. Jeff KingFeb 18, 2011
  3. Linus TorvaldsFeb 18, 2011
  4. Linus TorvaldsFeb 19, 2011
  5. Junio C HamanoFeb 19, 2011
  6. Linus TorvaldsFeb 19, 2011
  7. Linus TorvaldsFeb 19, 2011
  8. Linus TorvaldsFeb 19, 2011
  9. Junio C HamanoFeb 19, 2011
  10. Jeff KingFeb 19, 2011
  11. Jeff KingFeb 19, 2011
  12. 1/4 merge: improve inexact rename limit warningJeff King, Feb 19, 2011
  13. Junio C HamanoFeb 21, 2011
  14. Jeff KingFeb 22, 2011
  15. Junio C HamanoFeb 22, 2011
  16. Jeff KingFeb 23, 2011
  17. 2/4 bump rename limit defaults (again)Jeff King, Feb 19, 2011
  18. Piotr KrukowieckiFeb 19, 2011
  19. Jeff KingFeb 20, 2011
  20. Ævar Arnfjörð BjarmasonFeb 19, 2011
  21. Jeff KingFeb 20, 2011
  22. 3/4 commit: stop setting rename limitJeff King, Feb 19, 2011
  23. 4/4 inexact rename detection eye candyJeff King, Feb 19, 2011
  24. Linus TorvaldsFeb 19, 2011
  25. Jeff KingFeb 20, 2011
  26. 1/3 add inexact rename detection progress infrastructureJeff King, Feb 20, 2011
  27. 2/3 merge: enable progress reporting for rename detectionJeff King, Feb 20, 2011
  28. 3/3 pull: propagate --progress to mergeJeff King, Feb 20, 2011
  29. Jeff KingFeb 20, 2011
  30. Martin LanghoffFeb 19, 2011
  31. Jeff KingFeb 20, 2011
  32. Martin LanghoffFeb 20, 2011
  33. Martin LanghoffFeb 19, 2011
  34. Martin LanghoffFeb 19, 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.