From f6dae49a8d657518453c26d6dae22fda50b233c3 Mon Sep 17 00:00:00 2001 From: Caleb Owens Date: Mon, 26 Aug 2024 15:40:22 +0200 Subject: [PATCH] Commits and another enum correction --- crates/gitbutler-repo/src/rebase.rs | 2 +- crates/gitbutler-repo/src/repository_ext.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/gitbutler-repo/src/rebase.rs b/crates/gitbutler-repo/src/rebase.rs index 26f24a0cd..0a4b7f648 100644 --- a/crates/gitbutler-repo/src/rebase.rs +++ b/crates/gitbutler-repo/src/rebase.rs @@ -139,7 +139,7 @@ fn commit_conflicted_cherry_result<'repository>( // If the commit we're rebasing is conflicted, use the commits original base. let base_tree = if to_rebase.is_conflicted() { - repository.find_real_tree(&to_rebase, ConflictedTreeKey::Ours)? + repository.find_real_tree(&to_rebase, ConflictedTreeKey::Base)? } else { let base_commit = to_rebase.parent(0)?; repository.find_real_tree(&base_commit, Default::default())? diff --git a/crates/gitbutler-repo/src/repository_ext.rs b/crates/gitbutler-repo/src/repository_ext.rs index 98f2ffcd0..eb2efdfa1 100644 --- a/crates/gitbutler-repo/src/repository_ext.rs +++ b/crates/gitbutler-repo/src/repository_ext.rs @@ -402,12 +402,14 @@ impl RepositoryExt for git2::Repository { // we need to do a manual 3-way patch merge // find the base, which is the parent of to_rebase let base = if to_rebase.is_conflicted() { + // Use to_rebase's recorded base self.find_real_tree(to_rebase, ConflictedTreeKey::Base)? } else { let base_commit = to_rebase.parent(0)?; + // Use the parent's auto-resolution self.find_real_tree(&base_commit, Default::default())? }; - // Get the original ours + // Get the auto-resolution let ours = self.find_real_tree(head, Default::default())?; // Get the original theirs let thiers = self.find_real_tree(to_rebase, ConflictedTreeKey::Theirs)?;