Skip to content

Commit 0b32618

Browse files
committed
Use gitoxide in is_remote_branch_mergeable()
Unfortunately it doesn't seem to be called from the UI anymore, just in tests, so there isn't any benchmark results.
1 parent 922bdd9 commit 0b32618

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

crates/gitbutler-branch-actions/src/virtual.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,11 +1101,18 @@ pub fn is_remote_branch_mergeable(
11011101
let wd_tree = ctx.repository().create_wd_tree()?;
11021102

11031103
let branch_tree = branch_commit.tree().context("failed to find branch tree")?;
1104-
let mergeable = !ctx
1105-
.repository()
1106-
.merge_trees(&base_tree, &branch_tree, &wd_tree, None)
1104+
let gix_repo_in_memory = ctx.gix_repository_for_merging()?.with_object_memory();
1105+
let (merge_options_fail_fast, conflict_kind) = gix_repo_in_memory.merge_options_fail_fast()?;
1106+
let mergeable = !gix_repo_in_memory
1107+
.merge_trees(
1108+
git2_to_gix_object_id(base_tree.id()),
1109+
git2_to_gix_object_id(branch_tree.id()),
1110+
git2_to_gix_object_id(wd_tree.id()),
1111+
Default::default(),
1112+
merge_options_fail_fast,
1113+
)
11071114
.context("failed to merge trees")?
1108-
.has_conflicts();
1115+
.has_unresolved_conflicts(conflict_kind);
11091116

11101117
Ok(mergeable)
11111118
}

0 commit comments

Comments
 (0)