feat: warn when a new worktree omits untracked nested git repos (meta-repos)#4677
Open
diegoesolorzano wants to merge 4 commits into
Open
feat: warn when a new worktree omits untracked nested git repos (meta-repos)#4677diegoesolorzano wants to merge 4 commits into
diegoesolorzano wants to merge 4 commits into
Conversation
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.
Closes #4671
Problem
In meta-repo layouts (a parent repo containing independent nested git repos in subdirectories — e.g.
frontend/,backend/as their own repos, untracked by the parent),git worktree addonly materializes files tracked by the parent. Orca creates the worktree without any hint, and the user lands in a tree with no application code. The auto-detected setup command (root lockfile install) reinforces the illusion of a complete checkout.What this does
After a successful local create, if the source repo contains nested git repos not tracked by the parent, the create result carries a structured
nestedReposwarning and the renderer shows a toast listing the directories (capped at 10, with the real remainder count), reusing the existing post-create toast pattern (localBaseRefRefresh). Creation itself is never blocked or failed — detection is best-effort and resolvesnullon any scan/git failure or timeout.Tracked submodules never warn: candidates are filtered against staged gitlinks (
git ls-files -z --stage, mode 160000) and.gitmodulesdeclarations (git config --file .gitmodules) — those are intentional layouts that worktrees handle natively.Implementation notes
scanNestedReposfromproject-groups/nested-repo-discovery.ts) via its filesystem injection point, with two per-call overrides:isSelectedPathGitRepo: () => false(the scanner early-returns on git repos — it was built for non-git project folders) andreadTextFile: async () => ''(gitignored nested repos are exactly the meta-repo case this warning exists for; the scanner's hardcoded skip-dirs and symlink safety are preserved). The default filesystem is extracted into an exported factory in a separate, behavior-preserving commit.ls-files+ oneconfigcall regardless of candidate count. The scan runs concurrently with the create and is awaited just before the IPC result returns.Tests
worktrees.test.ts(attach/absent/concurrency/rejection-safety/remote-not-invoked).X: @diegoesolorzano