Repository navigation
docs(picker): drop stale dedupe git calls TODO - #2657
Merged
Merged
Conversation
`Repository::list_worktrees` has been cached on `RepoCache` since 2114fda (#2375), and the picker shares the cache across its main thread and the bg `picker-collect` thread via `Arc<RepoCache>` — exactly the dedup the TODO asked for. A `RUST_LOG=worktrunk=debug` trace of `wt switch` against the `picker-test` synthetic repo shows one `git worktree list --porcelain` subprocess per invocation; the pre-skeleton `RepoCache::worktrees` docstring already documents the contract. The TODO was originally added in #2250 and partially walked back in #2368 (the parenthetical that calls out the branch-inventory cache), but the body was never updated when #2375 closed the worktree half. No behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
worktrunk-bot
approved these changes
May 9, 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.
Summary
The TODO in
src/commands/picker/mod.rsasking to "dedupelist_worktreescalls betweennum_items_estimateandcollect::collect" has already been resolved.Repository::list_worktreeshas been cached onRepoCachesince 2114fda (#2375), and the picker shares that cache across its main thread and the bgpicker-collectthread viaArc<RepoCache>—repo.clone()shares theOnceCell<Vec<WorktreeInfo>>, so the second call is a memory hit.The
RepoCache::worktreesdocstring already states the contract: "The picker warms this on the main thread (for its preview-window sizing estimate) so the backgroundcollect::collectpass hits memory instead of respawning the subprocess on the critical path to skeleton."The TODO was originally added in #2250 and partially walked back in #2368 (the parenthetical noting the branch-inventory cache), but the body was never updated when #2375 closed the worktree half.
Verification
RUST_LOG=worktrunk=debug WORKTRUNK_PICKER_DRY_RUN=1 wt -C <picker-test> switchagainst thewt-perf setup picker-testrepo shows exactly onegit worktree list --porcelainsubprocess per invocation (1wt-tracerecord, 1 spawn debug line).No behavior change — pure doc-comment deletion (9 lines).
Test plan
pre-commit run --files src/commands/picker/mod.rs— passescargo check— passesgit worktree list --porcelainsubprocess perwt switch