Skip to content

Commit 5e44d9b

Browse files
author
Edward Thomson
committed
Better document git_merge_commits
`git_merge_commits` (and thus `git_merge`) do not use the same strategy as `git-merge-recursive` wherein they can produce an artificial common ancestor that is the merge of all common ancestors. Document this accordingly.
1 parent c4a2fd5 commit 5e44d9b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/git2/merge.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,10 @@ GIT_EXTERN(int) git_merge_trees(
479479
* or checked out. If the index is to be converted to a tree, the caller
480480
* should resolve any conflicts that arose as part of the merge.
481481
*
482+
* The merge performed uses the first common ancestor, unlike the
483+
* `git-merge-recursive` strategy, which may produce an artificial common
484+
* ancestor tree when there are multiple ancestors.
485+
*
482486
* The returned index must be freed explicitly with `git_index_free`.
483487
*
484488
* @param out pointer to store the index result in
@@ -501,6 +505,10 @@ GIT_EXTERN(int) git_merge_commits(
501505
* to the index. Callers should inspect the repository's index after this
502506
* completes, resolve any conflicts and prepare a commit.
503507
*
508+
* The merge performed uses the first common ancestor, unlike the
509+
* `git-merge-recursive` strategy, which may produce an artificial common
510+
* ancestor tree when there are multiple ancestors.
511+
*
504512
* For compatibility with git, the repository is put into a merging
505513
* state. Once the commit is done (or if the uses wishes to abort),
506514
* you should clear this state by calling

0 commit comments

Comments
 (0)