Subject: Re: [PATCH 00/19] Cleanup merge API

From: Junio C Hamano <[email-masked]>
Date: Thu, 25 Jul 2019 15:50:25 -0700

Elijah Newren <[email-masked]> writes:

> On Thu, Jul 25, 2019 at 11:12 AM Junio C Hamano <[email-masked]> wrote:
>
>> > Stuff I'd most welcome review on:
>> >   * Is cache-tree.c the right place for write_tree_from_memory()?
>> >     [see patch 7]  Should there be docs on how it differs from
>> >     write_index_as_tree(), already found in cache-tree?  What does
>> >     the latter even do?
>>
>> write_index_as_tree() is supposed to write the contents of an index
>> state as a tree object, and return the object ID for the resulting
>> tree.  It is the primary interface designed to be used by
>> write-tree.
>
> Other than the last sentence, that also sounds like the description of
> write_index_as_tree() -- at least as best I understood it.

Yes, I didn't even know merge-recursive had its own variant.  I
suspect that back when "merge-recursive in C" was being developed,
it first used "git write-tree" via run_command(), and then just
copied and pasted what was done in the write-tree implementation
without bothering to refactor it into write_index_as_tree() and its
own bits about the unmerged index.