Register Git submodules under their own project path (#61859)
Closes #61671
A submodule's `.git` is a file pointing into the superproject's
`.git/modules/<name>`, which looks just like a linked worktree's `.git`
file. The identity-path resolution used for recent projects and project
grouping treated them the same, so submodules got registered under
`.git/modules/<name>` instead of their own folder.
The fix detects submodule git dirs (`is_submodule_git_dir`) and skips
resolution for them, so a submodule keeps its own working directory as
its identity. Linked worktrees and bare repos are unaffected.
### Current vs. Expected
Current: opening submodule `Foo/Bar` registers the path as
`Foo/.git/modules/Bar`.
Expected: it registers as `Foo/Bar`, like any other project.
### Video
https://github.com/user-attachments/assets/e2eee5e7-ef64-47ed-9780-6fcafda5ae30
### Tests
- `is_submodule_git_dir` unit test
- `resolve_git_worktree_to_main_repo` returns `None` for a submodule
- persistence test asserting the submodule identity stays at its own
folder
Release Notes:
- Fixed Git submodules being registered under the parent repository's
`.git/modules` directory instead of their own path
998fbf30ffAyush Patil committed on 7/30/2026, 7:44:22 PM· committed by GitHubparent790dcef