Repository navigation
End or recreate a stuck session from the sidebar - #26
Merged
Merged
Conversation
`git worktree remove` on a tree deleted by hand drops git's record of it and exits 0. On a detached HEAD that record can be the only reference to a commit, which gc then collects. RemoveWorktree now reads the record first and refuses when no ref contains its HEAD, naming the commit and the `git branch` command that keeps it. Two dead ends go with it. A missing tree whose record was already pruned made Delete fail with "is not a working tree"; there is nothing to remove, so it now succeeds. A branch already gone made DeleteBranch fail, and the UI reported that as an unmerged branch kept; it now succeeds, checked with the new HasBranch.
The choice between closing outright and asking moves into endSession, which takes the session rather than reading the dashboard's cursor, so a second caller can end a session it found another way. No behaviour changes.
In the session view, x only stopped the agent and answered "session is not running" otherwise, so a row there could not be removed. A session whose worktree was deleted by hand never runs, which left it stuck. x and ^g x now stop a live agent as before, and on a session with nothing running they end it through endSession, as the dashboard does. When the worktree is gone and its branch still exists, the end modal offers Recreate first. gitx.RestoreWorktree checks the branch out again at the same path, and the project's ignored instruction files are linked back in. It needs the local branch, because `worktree add` would otherwise take a remote branch or tag of that name. It clears git's stale record through RemoveWorktree rather than prune or --force, and retries only while the path is still empty. Nothing claims a gone worktree is still on disk: the pane points at x instead of ↵, and the Close row and notice no longer say it was kept. Ending a session from the sidebar no longer moves the dashboard cursor of another project.
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.
In the session view,
xonly stopped the agent, so a session whose worktree was deleted by hand could not be removed or restarted from the sidebar.xand^g xin the session view now stop a live agent as before, and on a session with nothing running they end it through the same modal as the dashboard.git worktree prune, and on a branch that is already gone.Three commits: the gitx fix to removal, a refactor with no behaviour change, then the feature.
make racepasses locally. Every new guard has a test that fails when the guard is removed. Not tried in a real terminal; the UI tests drive the model directly.