merge-recursive: provide pair of `unpack_trees_{start,finish}()`
authorElijah Newren <newren@gmail.com>
Sun, 20 May 2018 10:17:35 +0000 (12:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 20 May 2018 21:56:15 +0000 (06:56 +0900)
commit3f1c1c360080114fcc9492211601f41d56112e3c
tree8cf815fa9e81bc8c7456ec88e27aadbbd9fe14c9
parent89e653da5b1bee9cf645e9d4bdd95f6bb31cc4b9
merge-recursive: provide pair of `unpack_trees_{start,finish}()`

Rename `git_merge_trees()` to `unpack_trees_start()` and extract the
call to `discard_index()` into a new function `unpack_trees_finish()`.
As a result, these are called early resp. late in `merge_trees()`,
making the resource handling clearer. A later commit will expand on
that, teaching `..._finish()` to free more memory. (So rather than
moving the FIXME-comment, just drop it, since it will be addressed soon
enough.)

Also call `..._finish()` when `merge_trees()` returns early.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Martin Ă…gren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c