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

Re: What's cooking in git.git (Aug 2008, #05; Tue, 19)

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 19, 2008, 19:19 UTC
Message-ID
<7vabf83j9u.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080819125429.GD17582@genesis.frugalware.org>
Miklos Vajna <vmiklos@frugalware.org> writes:
Show 15 quoted lines
> On Tue, Aug 19, 2008 at 02:05:42AM -0700, Junio C Hamano <gitster@pobox.com> wrote:
>> [On Hold]
>> (...)
>> * mv/merge-recursive (Tue Aug 12 22:14:00 2008 +0200) 3 commits
>>  - Make builtin-revert.c use merge_recursive_generic()
>>  - merge-recursive.c: Add more generic merge_recursive_generic()
>>  - Split out merge_recursive() to merge-recursive.c
>> 
>> I do not think builtlin-revert should use "recursive", but these patches
>> give a good starting point to separate the bulk of the "rename-aware
>> three-way merge" into library form.
>
> I wanted to send a patch that makes builtin-merge use the new
> merge_recursive_setup(), but then I was not able to decide to use
> merge_recursive_generic() or not.

I think git-merge and git-merge-recursive should be the only two that actually trigger the "recursive" behaviour. Everybody else should be using non-recursive one, and that non-recursive one can be shared by the one that is recursive.

Here is how the callchain looks like with your variant.
 cmd_merge_recursive()
 -> merge_recursive_setup()
 -> merge_recursive_generic()
    -> merge_recursive()
       -> merge_recursive()
       -> merge_trees()

The merge_recursive() is the "recursive" one. The workhorse that is not recursive is merge_trees().

Since the latter is what everybody else ("checkout -m", "revert", "cherry-pick", "am -3", "stash apply") should be using, I think it is pretty much up to "git-merge" and "git-merge-recursive" implementations how the caller of merge_recursive() function is structured. I suspect that you would not need two separate functions, _setup() and _generic(), for these two codepaths, but I didn't look closely.

And make_virtual_commit() should become static inside merge_recursive.c; use of these fake commits is strictly an internal implementation issue of how merge_recursive() function works and does not concern the caller, does it?

By the way, the calling convention of merge_recursive_generic() looks confusing (even though by the above reasoning it does not matter very much outside "git-merge" and "git-merge-recursive"). Why does it take textual object names for bases but binary object names for head and next?

Previous: Miklos VajnaNext: Miklos Vajna
Message 5 of 20 in “What's cooking in git.git (Aug 2008, #05; Tue, 19)”
  1. Junio C HamanoAug 19, 2008
  2. Johannes SixtAug 19, 2008
  3. Andreas FärberAug 19, 2008
  4. Miklos VajnaAug 19, 2008
  5. Junio C HamanoAug 19, 2008
  6. Miklos VajnaAug 19, 2008
  7. Junio C HamanoAug 19, 2008
  8. Miklos VajnaAug 20, 2008
  9. merge-recursive: introduce merge_optionsMiklos Vajna, Aug 25, 2008
  10. Junio C HamanoAug 25, 2008
  11. merge-recursive: introduce merge_optionsMiklos Vajna, Aug 25, 2008
  12. Junio C HamanoAug 28, 2008
  13. merge-recursive: fix subtree mergeMiklos Vajna, Aug 30, 2008
  14. Junio C HamanoAug 30, 2008
  15. Junio C HamanoAug 30, 2008
  16. Miklos VajnaAug 31, 2008
  17. Miklos VajnaSep 1, 2008
  18. builtin-revert: use merge_recursive_generic()Miklos Vajna, Sep 1, 2008
  19. Junio C HamanoSep 2, 2008
  20. Junio C HamanoSep 2, 2008

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.