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

Re: Handling merge conflicts a bit more gracefully..

From
Junio C Hamano <junkio@cox.net>
Date
Jun 9, 2005, 02:15 UTC
Message-ID
<7vll5kxolo.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.58.0506081757170.2286@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> I think that sounds reasonable. Is it not the case now?

Well, except that $I may validly be an empty tree ;-), so not quite.

In case it was not clear, where I am headed is this. I would like to rip out the two-tree "carry forward" implementation from read-tree, and replace it with:

    read_cache() -- current goes to stage0
    read_tree(H) -- H goes to stage1
    read_tree(M) -- M goes to stage3
    for each path
        if it appears in stage0, copy it to stage2
        else if it appears in stage1, copy it to stage2
    threeway_merge() !!

And then the resulting possibly unmerged cache can be resolved exactly the same way with merge-cache.

The trouble I feel with the current "carry forward" code is that when it works it does sensible thing, but otherwise does not help the end user at all. With all the work going into making merge-one-file-script nicer today, I think leveraging three-way merge support for two-tree fast forward case would make a lot more sense than keeping the all-or-nothing carry forward code I recently added to it.

When/if that happens, then the current fast-forward code would need to be changed from:

    read-tree -m $H $M && echo $M >.git/HEAD
to
    read-tree -m $H $M &&
    if unmerged paths in the resulting cache
    then
        merge-cache -o merge-one-file-script -a
    fi &&
    echo $M >.git/HEAD

and the user's local changes since H when fast forwarding to M would be handled with the same workflow as the three-way case.

Hmm.
Previous: Linus TorvaldsNext: Linus Torvalds
Message 9 of 33 in “Handling merge conflicts a bit more gracefully..”
  1. Linus TorvaldsJun 8, 2005
  2. Junio C HamanoJun 8, 2005
  3. Linus TorvaldsJun 8, 2005
  4. Junio C HamanoJun 9, 2005
  5. Linus TorvaldsJun 9, 2005
  6. Junio C HamanoJun 9, 2005
  7. Junio C HamanoJun 9, 2005
  8. Linus TorvaldsJun 9, 2005
  9. Junio C HamanoJun 9, 2005
  10. Linus TorvaldsJun 9, 2005
  11. Junio C HamanoJun 9, 2005
  12. Linus TorvaldsJun 9, 2005
  13. Junio C HamanoJun 9, 2005
  14. 0/3 Handling merge conflicts a bit more gracefullyJunio C Hamano, Jun 9, 2005
  15. 1/3 read-tree.c: rename local variables used in 3-way merge code.Junio C Hamano, Jun 9, 2005
  16. 2/3 read-tree -m 3-way: loosen index requirements that is too strict.Junio C Hamano, Jun 9, 2005
  17. 3/3 read-tree -m 3-way: handle more trivial merges internallyJunio C Hamano, Jun 9, 2005
  18. Linus TorvaldsJun 9, 2005
  19. Junio C HamanoJun 9, 2005
  20. Linus TorvaldsJun 9, 2005
  21. Junio C HamanoJun 9, 2005
  22. Add git-diff-stages command.Junio C Hamano, Jun 9, 2005
  23. Linus TorvaldsJun 9, 2005
  24. diff-stages: unuglify the too big main() function.Junio C Hamano, Jun 11, 2005
  25. Junio C HamanoJun 10, 2005
  26. Herbert XuJun 18, 2005
  27. Linus TorvaldsJun 18, 2005
  28. Jeff GarzikJun 9, 2005
  29. Linus TorvaldsJun 9, 2005
  30. read-tree.c: rename local variables used in 3-way merge code.Junio C Hamano, Jun 9, 2005
  31. Handle entry removals during merge correctly.Junio C Hamano, Jun 9, 2005
  32. read-tree -m 3-way: loosen an index requirement that was too strict.Junio C Hamano, Jun 9, 2005
  33. read-tree -m 3-way: handle more trivial merges internally.Junio C Hamano, Jun 9, 2005

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.