Andreas Wendleder reports a crash when submodule.recurse=true and a superproject worktree's submodule is itself a linked worktree of the submodule repository. Switching branches then aborts with: "BUG: submodule.c:2414: submodule name 'sub' not a suffix of git dir '.../.git/modules/sub/worktrees/sub1'".

The report includes a self-contained shell reproduction. It was run on git 2.56.0, and Wendleder says the code is the same on master, next and seen.

The message shows the assertion in validate_submodule_legacy_git_dir() fires because the git directory of a linked worktree under .git/modules/sub/worktrees/ does not end with the submodule name. No replies are in the excerpts.