Skip to content

Commit 9a22abc

Browse files
committed
fix: don't be tripped up by empty stacks in the vb.toml adapter.
We can't handle them well there and it's unclear what to do, and we generally ignore them
1 parent 6707cdd commit 9a22abc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/but-graph/src/ref_metadata_legacy.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl RefMetadata for VirtualBranchesTomlMetadata {
323323
}) {
324324
Some(branch) => branch,
325325
None => branches_to_create.pop().context(
326-
"BUG: do not pop off the last branch, remove the whole stack",
326+
"BUG: incoming stack is probably empty, caller should have removed the whole stack",
327327
)?,
328328
};
329329

@@ -560,6 +560,8 @@ impl VirtualBranchesTomlMetadata {
560560
ref_info: managed_ref_info(),
561561
stacks: stacks
562562
.iter()
563+
// We aren't able to handle these well, so let's ignore them.
564+
.filter(|stack| !stack.heads.is_empty())
563565
.sorted_by_key(|s| s.order)
564566
.map(|s| WorkspaceStack {
565567
id: s.id,

crates/but-graph/tests/graph/ref_metadata_legacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ fn create_workspace_from_scratch_workspace_first() -> anyhow::Result<()> {
10541054
let err = store.set_workspace(&ws).unwrap_err();
10551055
assert_eq!(
10561056
err.to_string(),
1057-
"BUG: do not pop off the last branch, remove the whole stack"
1057+
"BUG: incoming stack is probably empty, caller should have removed the whole stack"
10581058
);
10591059
ws.stacks.pop();
10601060
assert_eq!(ws.stacks.len(), 1);

0 commit comments

Comments
 (0)