File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -2018,6 +2018,26 @@ int git_merge_trees(
20182018 git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT ;
20192019 int error ;
20202020
2021+ assert (out && repo );
2022+
2023+ /* if one side is treesame to the ancestor, take the other side */
2024+ if (ancestor_tree && merge_opts && (merge_opts -> flags & GIT_MERGE_SKIP_REUC )) {
2025+ const git_tree * result = NULL ;
2026+ const git_oid * ancestor_tree_id = git_tree_id (ancestor_tree );
2027+
2028+ if (our_tree && !git_oid_cmp (ancestor_tree_id , git_tree_id (our_tree )))
2029+ result = their_tree ;
2030+ else if (their_tree && !git_oid_cmp (ancestor_tree_id , git_tree_id (their_tree )))
2031+ result = our_tree ;
2032+
2033+ if (result ) {
2034+ if ((error = git_index_new (out )) == 0 )
2035+ error = git_index_read_tree (* out , result );
2036+
2037+ return error ;
2038+ }
2039+ }
2040+
20212041 iter_opts .flags = GIT_ITERATOR_DONT_IGNORE_CASE ;
20222042
20232043 if ((error = git_iterator_for_tree (
You can’t perform that action at this time.
0 commit comments