I've tried commit 779bc886:
✓ within "nested" projects (e.g. when $HOME is under version control,
and visiting the Emacs repo under ~/src/emacs), project-find-file uses
the innermost project (~/src/emacs) as root,
✓ at the root of a Git worktree (e.g. when ~/src/emacs-26.3 is a
worktree of ~/src/emacs, and visiting ~/src/emacs-26.3),
project-find-file uses the worktree (~/src/emacs-26.3) as root,
❌ in a subfolder of a Git worktree (e.g. in ~/src/emacs-26.3/src),
project-find-file signals:
project-try-vc: Opening input file: No such file or directory,
/home/$USER/src/emacs-26.3/src/.git
✓ at the root of a Git submodule (e.g. when ~/projects/foo/bar is a
submodule of ~/projects/foo, and visiting ~/projects/foo/bar),
project-find-file uses the parent module (~/projects/foo) as root,
❌ in a subfolder of a Git submodule (e.g. in
~/projects/foo/bar/baz), project-find-file signals:
project-try-vc: Opening input file: No such file or directory,
/home/$USER/projects/foo/bar/baz/.git