Skip to content

Commit 5856b9d

Browse files
committed
Use gix-merge to merge trees when cherry-picking.
1 parent 3a3fd30 commit 5856b9d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

crates/gitbutler-cherry-pick/src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,21 @@ impl Deref for ConflictedTreeKey {
4040
}
4141

4242
pub trait RepositoryExt {
43+
/// Cherry-pick, but understands GitButler conflicted states.
44+
///
45+
/// This method *should* always be used in favour of native functions.
4346
fn cherry_pick_gitbutler(
4447
&self,
4548
head: &git2::Commit,
4649
to_rebase: &git2::Commit,
4750
merge_options: Option<&MergeOptions>,
4851
) -> Result<git2::Index, anyhow::Error>;
52+
53+
/// Find the real tree of a commit, which is the tree of the commit if it's not in a conflicted state
54+
/// or the tree according to `side` if it is conflicted.
55+
///
56+
/// Unless you want to find a particular side, you likely want to pass Default::default()
57+
/// as the [`side`](ConflictedTreeKey) which will give the automatically resolved resolution
4958
fn find_real_tree(
5059
&self,
5160
commit: &git2::Commit,
@@ -54,10 +63,6 @@ pub trait RepositoryExt {
5463
}
5564

5665
impl RepositoryExt for git2::Repository {
57-
/// cherry-pick, but understands GitButler conflicted states
58-
///
59-
/// cherry_pick_gitbutler should always be used in favour of libgit2 or gitoxide
60-
/// cherry pick functions
6166
fn cherry_pick_gitbutler(
6267
&self,
6368
head: &git2::Commit,
@@ -83,11 +88,6 @@ impl RepositoryExt for git2::Repository {
8388
.context("failed to merge trees for cherry pick")
8489
}
8590

86-
/// Find the real tree of a commit, which is the tree of the commit if it's not in a conflicted state
87-
/// or the parent parent tree if it is in a conflicted state
88-
///
89-
/// Unless you want to find a particular side, you likly want to pass Default::default()
90-
/// as the ConfclitedTreeKey which will give the automatically resolved resolution
9191
fn find_real_tree(
9292
&self,
9393
commit: &git2::Commit,

crates/gitbutler-repo/src/repository_ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ pub trait GixRepositoryExt: Sized {
749749
their_tree: gix::ObjectId,
750750
) -> Result<bool>;
751751

752-
/// Return default lable names when merging trees.
752+
/// Return default label names when merging trees.
753753
///
754754
/// Note that these should probably rather be branch names, but that's for another day.
755755
fn default_merge_labels(&self) -> gix::merge::blob::builtin_driver::text::Labels<'static> {

0 commit comments

Comments
 (0)