Repository navigation
Show a deleting worktree at once and drop its row without re-reading every project - #228
Merged
Merged
Conversation
…every project The checkout row dims with a spinner from confirmation until Git answers. A finished removal takes its row out of the catalog in the same frame and counts itself in the worktree request, so a read that began earlier cannot bring the row back and only the removed repository is read again. The host moves the folder aside into the repository's Git directory before git worktree remove drops the registration, and deletes it in the background, so a large build folder no longer outlasts the 15 s Git read bound.
This was referenced Sep 28, 2026
Closed
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.
Related: #224 (the dialog options this builds on)
Summary
After confirming
Delete worktree…, the sidebar row looked untouched, and it stayed after the dialog said "Deleted" until every project's Git state was re-read.The row is now dimmed with a spinner from the confirmation, cannot be opened, and leaves within about a second of the removal finishing.
A finished removal drops its row from the catalog in the same frame; only the removed repository is read again, not every project.
The host moves the folder aside into the repository's Git directory, lets
git worktree removedrop only the registration, and deletes the files in the background.Before, a 1.5 GB build folder with 400k files took 38.9 s in
git worktree remove, past the 15 s Git read bound that killed it.Review
<git common dir>/hide-removed/until a background thread deletes it. A leftover from a stopped process is swept by the next removal in that repository, not at startup.Openand a secondDelete worktree…are unreachable.hide-host/src/worktrees.rs(failure path, destructive):set_asidemoves only when Git would remove (registered, not main, not locked, clean unless forced); a refusal moves the folder back;sweep_trashdeletes an entry only once Git's admin folder no longer registers it.herdr-core/src/runtime/projects.rs(runtime mutex):drop_removed_worktreeedits the catalog in memory under the lock; no Git or filesystem work was added there.herdr-core/src/session_sync/coordinator.rs: the navigator is rebuilt on the 250 ms wake that seesWorktreeRequest::removalsmove, since the next read may find nothing new.herdr-core/src/worktrees.rs:removalsrides through the reader and back, so a read that started before the removal cannot bring the row back.Evidence
Confirmed: confirm-to-row-gone in the web shell against an isolated Herdr, 5 cloned projects with 2 extra worktrees each, a real 2.2 GB
target/copied into the deleted worktree, 3 trials each (load average 7 to 10).The dimmed row appears 10 to 23 ms after the confirm click; the dialog's "finished" arrives at 0.4 to 0.9 s in both builds.
Confirmed: host tests cover a 5,000-file build folder removed by setting it aside with the trash drained, Git's own dirty and locked refusals leaving the folder in place, and a stopped-midway entry kept until a retry drops the registration and deletes it once.
Confirmed: runtime tests cover the row dropped without a global re-read, an older read unable to restore it, a newer read restoring a re-created worktree, and a failed removal keeping its row.
Confirmed:
e2e/worktree-delete.spec.tsnow also observes the dimmed, spinner, disabled row during removal;verify-cargo.sh test,verify-cargo.sh lint,verify-web.sh, the design contract and thescriptslane checks pass locally.Not confirmed: not run in the packaged desktop app; the measurements and screenshots are the web shell served by a dev
hided.Not confirmed: the cross-volume fallback (in place, 60 s
REMOVE_DEADLINE) has no test; device removals are unchanged and still re-read the device's catalog.Not confirmed: a trash entry whose deletion fails (for example a read-only folder inside it) stays until the next sweep and is only logged.
More evidence
Review follow-ups not taken: a reader-level test that drives a real in-flight read across a removal, and a note that the clean check and the rename are two steps (the confirmation rechecks status just before).
AI tooling: mostly AI tooling; the removal states, timings and trash behavior were checked by hand against the screenshots, measurement output and test assertions.