Skip to content

Skip linked worktrees of the same repository nested under the project root (#746) - #1010

Queued
aft-alfonso[bot] wants to merge 2 commits into
mainfrom
land/skip-nested-worktrees
Queued

aft-alfonso[bot] wants to merge 2 commits into
mainfrom
land/skip-nested-worktrees

Conversation

@aft-alfonso

@aft-alfonso aft-alfonso Bot commented Oct 26, 2026

Copy link
Copy Markdown

Fixes #746. A project folder that contains linked git worktrees of its own repository (for example under .worktrees/) was walked again for each worktree, so text search, semantic indexing, inspect and the watcher handled tens of thousands of duplicate files and search returned duplicate hits. Ufuk decided to skip them in every walk.

One shared boundary (project_content::NestedWorktreeBoundary) marks a directory as a nested linked worktree when its .git is a file whose gitdir resolves into this repository's common dir under worktrees/. Every content-reading walk prunes it: the trigram build and refresh, semantic enumeration, grep and glob fallback walks, the callgraph walk, inspect's entry-point and resolver walks, and the file watcher. Nested independent repositories and submodules are still walked. A path the agent names explicitly inside such a worktree is still read, the same rule as an explicitly named gitignored path.

Tests use real git fixtures (git init plus git worktree add into a subfolder) for each walk, an independent nested repo, a submodule-style gitdir, a worktree of another repository, and an explicitly named target.

ualtinok and others added 2 commits October 26, 2026 23:55
Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
(cherry picked from commit 3f3b801d3c12a2eac64b2955e89c3c79511d84a8)
…se note

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
@ualtinok
ualtinok added this pull request to the merge queue Oct 26, 2026
Any commits made after this event will not be merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Call-graph store is rebuilt from scratch on every engine start; refreshes on a 66k-file root read 176 GB in two days

1 participant