Skip to content

caleb/fix-remote-only-segments-in-workspace#14649

Open
Caleb-T-Owens wants to merge 2 commits into
masterfrom
caleb/fix-remote-only-segments-in-workspace
Open

caleb/fix-remote-only-segments-in-workspace#14649
Caleb-T-Owens wants to merge 2 commits into
masterfrom
caleb/fix-remote-only-segments-in-workspace

Conversation

@Caleb-T-Owens

@Caleb-T-Owens Caleb-T-Owens commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The goal of this was to try and avoid showing an "empty" (IE no commits or local ref) origin/master segment 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:

@Caleb-T-Owens Caleb-T-Owens requested a review from krlvi as a code owner July 7, 2026 12:47
Copilot AI review requested due to automatic review settings July 7, 2026 12:47
@github-actions github-actions Bot added the rust Pull requests that update Rust code label Jul 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --detach at 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`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better.

be happy.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coo, responds

@linear-code

linear-code Bot commented Jul 7, 2026

Copy link
Copy Markdown

GB-1570

GB-1722

@Caleb-T-Owens Caleb-T-Owens force-pushed the caleb/fix-remote-only-segments-in-workspace branch from aa822fe to 1252504 Compare July 7, 2026 15:00
Copilot AI review requested due to automatic review settings July 7, 2026 18:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

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 =
@mtsgrd mtsgrd force-pushed the caleb/fix-remote-only-segments-in-workspace branch from 6445913 to 6baf7f2 Compare July 7, 2026 18:50
@mtsgrd

mtsgrd commented Jul 7, 2026

Copy link
Copy Markdown
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.

@Caleb-T-Owens Caleb-T-Owens force-pushed the caleb/fix-remote-only-segments-in-workspace branch from 6baf7f2 to 6445913 Compare July 8, 2026 08:32
@Caleb-T-Owens Caleb-T-Owens force-pushed the caleb/fix-remote-only-segments-in-workspace branch from 6445913 to 1f3aa65 Compare July 8, 2026 09:44
@Caleb-T-Owens Caleb-T-Owens enabled auto-merge July 8, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants