Add workspace search for initialized git submodules#1000
Add workspace search for initialized git submodules#1000riley-wv wants to merge 3 commits intopingdotgg:mainfrom
Conversation
- recurse through initialized git submodules when building git-backed workspace indexes - include tracked and untracked files from initialized submodules in workspace search results - exclude parent repo gitlink entries so submodule roots are indexed as directories, not files - propagate truncation state across recursive submodule scans - add regression coverage for submodule indexing and refresh the generated MSW worker asset
📝 WalkthroughWalkthroughThis PR implements comprehensive Git submodule support in workspace indexing, introducing utilities to detect initialized submodules, enumerate files within them, and aggregate results with concurrent processing. The changes enable workspace entry resolution for files residing in Git submodules, alongside corresponding test coverage for submodule handling and edge cases. Changes
Sequence DiagramsequenceDiagram
participant Repo as Git Repository
participant Indexer as Workspace Indexer
participant SubmoduleScanner as Submodule Scanner
participant Aggregator as File Aggregator
participant Index as Workspace Index
Repo->>Indexer: buildWorkspaceIndexFromGit(cwd)
activate Indexer
Indexer->>SubmoduleScanner: listInitializedGitSubmodulePaths()
activate SubmoduleScanner
SubmoduleScanner->>Repo: git config --file .gitmodules
SubmoduleScanner-->>Indexer: [submodule_paths]
deactivate SubmoduleScanner
Indexer->>Indexer: listGitWorkspaceFilePaths(main repo)
Note over Indexer: Enumerate files in main repository
Indexer->>SubmoduleScanner: mapWithConcurrency(listGitWorkspaceFilePaths per submodule)
activate SubmoduleScanner
loop For each submodule with concurrency
SubmoduleScanner->>Repo: git ls-files (per submodule)
Repo-->>SubmoduleScanner: file_list
end
SubmoduleScanner-->>Indexer: [aggregated_file_paths, truncated_state]
deactivate SubmoduleScanner
Indexer->>Aggregator: Aggregate main repo + submodule files
activate Aggregator
Aggregator->>Aggregator: Filter duplicate/submodule paths
Aggregator-->>Indexer: consolidated_file_paths
deactivate Aggregator
Indexer->>Index: Build directory & file entries from aggregated paths
activate Index
Index-->>Indexer: workspace_index
deactivate Index
Indexer-->>Repo: Indexed workspace with submodule support
deactivate Indexer
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…xing - add coverage for nested initialized git submodules in workspace search - verify submodule-local ignore rules are respected when indexing submodule files - extract small git test helpers to keep submodule setup readable - harden the existing regression suite against future indexing regressions
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
What Changed
Resolves #997
Workspace search now indexes files inside initialized Git submodules instead of stopping at the submodule boundary.
This PR:
Why
Files inside initialized submodules were missing from workspace search results even when those submodules were present in the checked-out workspace. Recursing through submodules fixes that gap, and the added tests protect the implementation details most likely to regress: nested traversal and correct ignore handling inside submodules.
Checklist
Note
Add workspace search for initialized git submodules
listInitializedGitSubmodulePathsin workspaceEntries.ts to enumerate initialized submodule directories viagit submodule foreach --quiet pwd, resolving them to relative paths.listGitWorkspaceFilePathsto recursively list files from each submodule (up to 8 concurrent scans), respecting each submodule's own.gitignorerules and excluding submodule root paths from the top-level file listing.buildWorkspaceIndexFromGitto delegate file discovery tolistGitWorkspaceFilePaths, so submodule contents appear as directory/file entries rather than opaque file entries.Macroscope summarized 57e1aef.
Summary by CodeRabbit