Add another but-graph test to pin existing behavior#13222
Merged
Byron merged 1 commit intogitbutlerapp:masterfrom Apr 13, 2026
Merged
Add another but-graph test to pin existing behavior#13222Byron merged 1 commit intogitbutlerapp:masterfrom
but-graph test to pin existing behavior#13222Byron merged 1 commit intogitbutlerapp:masterfrom
Conversation
|
@Byron is attempting to deploy a commit to the GitButler Team on Vercel. A member of the Team first needs to authorize it. |
a334936 to
9fbbb21
Compare
but-graph test to pin existing behavior
…'t get its own segment. This is fine, as the only thing that matters is a segment for the target branch. Of course, there could be code that tries to find the local tracking branch of the remote tracking branch that is the target branch, but for now I think it's ok to assume it doesn't exist or that it doesn't lead to issues. It should always be possible to have a utility function that uses sibling links if present, but falls back to brute-force search through commits and their assigned references.
9fbbb21 to
b0e7039
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a regression test in but-graph to pin behavior around workspace target resolution when multiple refs compete on the same base commit (including presence of refs/remotes/origin/HEAD), ensuring the exact target segment for refs/remotes/origin/main remains present/empty even when an inactive “unapplied” stack exists.
Changes:
- Add a new workspace-focused graph test covering “shared target base + inactive unapplied branch” behavior.
- Add a new git fixture scenario that creates competing local refs plus
refs/remotes/origin/HEADalongsideorigin/main.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/but-graph/tests/graph/init/with_workspace.rs | Adds a new regression test + snapshots asserting target-segment and workspace target_ref resolution behavior. |
| crates/but-graph/tests/fixtures/scenarios.sh | Adds a new fixture scenario to reproduce the ref-competition shape used by the new test. |
krlvi
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR ultimately was hunting a phantom in #13222, which apparently needs more finesse to lure out in a test.
But this hunt at least led to an additional test which I think covers something worth pinning down: the local tracking branch to the remote tracking branch that is the
targetisn't special, and it's valid for it to disappear if there is competition.Old
Summary
but-graphalways creates an exact target segment for configured workspace target refs when the graph would otherwise only contain the local tracking segmentTasks
Root Cause
but-graphcould end up with only a local tracking segment likemain <> origin/mainand no exactrefs/remotes/origin/mainsegment. The workspace projection expects the configured target ref to exist as its own segment, so target resolution could fail or become shape-dependent after post-processing.Impact
This normalizes the graph shape for configured workspace targets so downstream workspace logic can rely on the exact target segment existing when possible.
Validation
cargo fmt --check --allcargo test -p but-graphNotes