Re: [PATCH 00/19] Cleanup merge API
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 25, 2019, 22:50 UTC
- Message-ID
- <xmqq7e85pw3y.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <CABPp-BGkGch-ebOrJTprw3oGgubgZyyVBCCM30VLbC24BU+MUQ@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 15 quoted lines
> On Thu, Jul 25, 2019 at 11:12 AM Junio C Hamano <gitster@pobox.com> 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.