Skip to content

Commit 867a282

Browse files
committed
Mark the definitive place for the new Unmerged stack relation
It's left for later to implement, if we want to use it. It will definitely be relevant for worktrees, so let's not forget about it.
1 parent c463e2e commit 867a282

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

crates/but-workspace/src/commit.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ impl std::fmt::Debug for Stack {
3737

3838
/// Structures related to creating a merge-commit along with the respective tree.
3939
pub mod merge {
40+
use super::Stack;
41+
use crate::WorkspaceCommit;
4042
use anyhow::{Context, bail};
43+
use but_core::ref_metadata::WorkspaceCommitRelation;
4144
use but_graph::SegmentIndex;
4245
use gitbutler_oxidize::GixRepositoryExt;
4346
use gix::prelude::ObjectIdExt;
4447
use tracing::instrument;
4548

46-
use super::Stack;
47-
use crate::WorkspaceCommit;
48-
4949
/// A minimal stack for to represent a stack that conflicted.
5050
#[derive(Debug, Clone)]
5151
pub struct ConflictingStack {
@@ -125,8 +125,17 @@ pub mod merge {
125125
let mut missing_stacks = Vec::new();
126126
let mut tips: Vec<_> = stacks
127127
.into_iter()
128-
.filter_map(|s| s.branches.first())
129-
.filter_map(|top_segment| {
128+
.filter_map(|s| s.branches.first().map(|b| (b, s.workspacecommit_relation)))
129+
.filter_map(|(top_segment, relation)| {
130+
match relation {
131+
WorkspaceCommitRelation::Merged => {}
132+
WorkspaceCommitRelation::UnmergedTree => {
133+
// These need to be part of the parents list, but shouldn't be merged.
134+
// If the caller wants to retry them, they can be passed here as "Merged".
135+
todo!("this is a placeholder for where we will have to start handling this UnmergedTree")
136+
}
137+
WorkspaceCommitRelation::Outside => return None,
138+
}
130139
let stack_tip_name = top_segment.ref_name.as_ref();
131140
match graph.segment_and_commit_by_ref_name(stack_tip_name) {
132141
None => {

0 commit comments

Comments
 (0)