Skip to content

Commit 03e0aec

Browse files
authored
Merge pull request #8935 from Byron/graph-segmentation
graph segmentation
2 parents 0b31d65 + 741fcf6 commit 03e0aec

File tree

25 files changed

+4051
-1324
lines changed

25 files changed

+4051
-1324
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/but-core/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ pub trait RefMetadata {
118118
})
119119
}
120120

121+
/// Like [`workspace()`](Self::workspace()), but instead of possibly returning default values, return an
122+
/// optional workspace instead.
123+
///
124+
/// This means the returned workspace data is never the default value.
125+
fn workspace_opt(
126+
&self,
127+
ref_name: &gix::refs::FullNameRef,
128+
) -> anyhow::Result<Option<Self::Handle<ref_metadata::Workspace>>> {
129+
let ws = self.workspace(ref_name)?;
130+
Ok(if ws.is_default() { None } else { Some(ws) })
131+
}
132+
121133
/// Set workspace metadata to match `value`.
122134
fn set_workspace(
123135
&mut self,

crates/but-core/src/ref_metadata.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/// We would have to detect this case by validating parents, and the refs pointing to it, before
1212
/// using the metadata, or at least have a way to communicate possible states when trying to use
1313
/// this information.
14-
#[derive(Default, Debug, Clone, PartialEq)]
14+
#[derive(Default, Debug, Clone, PartialEq, Eq)]
1515
pub struct Workspace {
1616
/// Standard data we want to know about any ref.
1717
pub ref_info: RefInfo,
@@ -125,7 +125,7 @@ impl RefInfo {
125125
}
126126

127127
/// A stack that was applied to the workspace, i.e. a parent of the *workspace commit*.
128-
#[derive(Debug, Clone, PartialEq)]
128+
#[derive(Debug, Clone, PartialEq, Eq)]
129129
pub struct WorkspaceStack {
130130
/// All branches that were reachable from the tip of the stack that at the time it was merged into
131131
/// the *workspace commit*.
@@ -138,7 +138,7 @@ pub struct WorkspaceStack {
138138

139139
/// A branch within a [`WorkspaceStack`], holding per-branch metadata that is
140140
/// stored alongside a stack that is available in a workspace.
141-
#[derive(Debug, Clone, PartialEq)]
141+
#[derive(Debug, Clone, PartialEq, Eq)]
142142
pub struct WorkspaceStackBranch {
143143
/// The name of the branch.
144144
pub ref_name: gix::refs::FullName,

crates/but-graph/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ gix.workspace = true
1717
bstr.workspace = true
1818
petgraph = "0.8.1"
1919
anyhow.workspace = true
20+
bitflags = "2.9.1"
2021

2122
# For `VirtualBranchesTomlRefMetadata`
2223
gitbutler-fs.workspace = true
@@ -32,3 +33,7 @@ insta = "1.43.1"
3233
termtree = "0.5.1"
3334
but-testsupport.workspace = true
3435
regex = "1.11.1"
36+
37+
# Just to setup test-data - for some reason we have to do target-ref by hand.
38+
git2.workspace = true
39+
gitbutler-reference.workspace = true

0 commit comments

Comments
 (0)