Repository navigation
Reduce redundant Git and worktree lookups - #579
Merged
skarim merged 2 commits intoOct 22, 2026
Merged
Conversation
skarim
added this pull request to stack #580
October 22, 2026 02:28
skarim
force-pushed
the
skarim/worktree-probe-optimizations
branch
from
October 22, 2026 05:15
c762657 to
0eea91b
Compare
skarim
marked this pull request as ready for review
October 22, 2026 14:30
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped refactor preserves existing safety checks, adds focused regression coverage, and has no identified blocking issues.
No open issues 🎉
What changed in this PR
This PR reduces repeated Git lookups in scoped worktree operations while preserving per-call validation and avoiding persistent caching.
Changes:
- Reuses directory paths obtained during the current identity validation.
- Reuses the preflight executor when preparing a branch.
- Adds regression tests for lookup counts, per-call freshness, and cleanliness checks.
| File | Description |
|---|---|
internal/worktree/context.go |
Extracts shared preflight logic and reuses its executor in Prepare. |
internal/worktree/context_test.go |
Tests executor reuse and cleanliness checks within each call. |
internal/git/worktree.go |
Reuses validated directory metadata for lookups and worktree selection. |
internal/git/gitops.go |
Routes GitDir through the validated directory helper. |
internal/git/gitops_test.go |
Tests reduced directory probes and revalidation after a worktree moves. |
Review effort: Balanced
francisfuzz
reviewed
Oct 22, 2026
francisfuzz
approved these changes
Oct 22, 2026
francisfuzz
left a comment
Contributor
There was a problem hiding this comment.
🚢 , left one non-blocking comment
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.
Optimizes GitOps and worktree operations by reducing repeated lookups, and updates the regression tests to preserve existing safety checks.
Functionality and impact
Key areas to review