caleb/fix-remote-only-segments-in-workspace#14649
Open
Caleb-T-Owens wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts workspace graph initialization/projection to better handle the case where HEAD is detached exactly at the configured target commit, preventing the workspace view from producing a “base-only” anonymous stack segment (no ref name and no commits) and ensuring detached entrypoints don’t retain upstream metadata from the branch they were detached from.
Changes:
- Clear remote-tracking metadata from the entrypoint segment when it is anonymized for a detached
HEAD. - Drop the single base-only stack during workspace projection when the only remaining segment is anonymous (detached-at-base case).
- Add a fixture scenario + regression test covering
git switch main --detachat the target tip.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/but-rebase/src/graph_rebase/mod.rs | Comment typo fix in commit-mapping documentation. |
| crates/but-graph/tests/graph/init/with_workspace.rs | Adds regression test for detached-HEAD-at-target workspace projection behavior. |
| crates/but-graph/tests/fixtures/scenarios.sh | Adds a new fixture repo scenario for detached HEAD at the target tip. |
| crates/but-graph/src/projection/workspace/init.rs | Drops the base-only anonymous stack in the detached-at-base case during workspace projection. |
| crates/but-graph/src/init/mod.rs | Ensures anonymized entrypoint segments don’t keep remote-tracking/upstream metadata after detaching. |
Comment on lines
464
to
468
| /// The commit mappings starts empty, and gets updated when we perform a cherry pick. | ||
| /// If there is no entry whose old `to` that cooresponds with the new | ||
| /// If there is no entry whose old `to` that corresponds with the new | ||
| /// `from`, then we just add a `to <- from` entry. | ||
| /// If there is an entry whose old `to` that cooresponds with the new | ||
| /// If there is an entry whose old `to` that corresponds with the new | ||
| /// `from`, then we replace `old_to <- old_from` with `new_to <- old_from` |
Contributor
Author
There was a problem hiding this comment.
it's better.
be happy.
aa822fe to
1252504
Compare
Comment on lines
+447
to
+451
| // A detached HEAD parked exactly on the base has no branch container | ||
| // to show - don't mint a stack for it, mirroring the managed path's | ||
| // base-segment discard. | ||
| |s| { | ||
| let discard = |
6445913 to
6baf7f2
Compare
Contributor
|
@Caleb-T-Owens could you look at the commit I pushed? It's done by claude, but to me it makes sense. If you agree feel free to just squash this into your commit to avoid the code churn. |
6baf7f2 to
6445913
Compare
6445913 to
1f3aa65
Compare
estib-vega
approved these changes
Jul 8, 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.

The goal of this was to try and avoid showing an "empty" (IE no commits or local ref)
origin/mastersegment in the workspace projection. A situation that seems to occur in a detached head scenario.This is part 1 of 2 in a stack made with GitButler: