Added ObjectDatabase.MergeTrees() to merge trees directly #2097
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This wraps the libgit2 function git_merge_trees() and so allows one to merge trees directly (specifying the ancestor tree to use in the 3-way merge). This functionality currently does not seem to be possible in libgit2sharp since the merge methods always take commits and do not allow to specify the ancestor. So, for instance, if I want to compute an octopus-merge ancestor and then iteratively merge N commits relative to this ancestor, then I cannot currently do this. With MergeTrees() one can. Later, one may write the resulting index to a tree via Index.WriteToTree() and create a commit with ObjectDatabase.CreateCommit().
Notes:
(this was a pull request over two years ago, but I recently rebased on a later version of libgit2sharp, which accidentally deleted it)