You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Follow submodule gitdir files when opening and perform basic validation (#2585)
Modern submodules store a .git file in the worktree whose gitdir: value points
at the repository to open. The previous resolver treated every non-directory
.git path like an uninitialized submodule and fell back to .git/modules/<name>,
which can open the wrong repository after a submodule gitdir is relocated or
renamed. That shows up as phantom submodule HEAD changes in gix status.
Git baseline: Git setup.c::read_gitfile_gently() parses gitdir:
files and resolves relative targets against the .git file location;
submodule.c::submodule_to_gitdir() consults that gitfile before falling back to
the name-derived .git/modules path.
Update Submodule::git_dir_try_old_form() to validate the submodule name, then
follow worktree .git files when present while preserving the old-form directory
and uninitialized fallback behavior. Validate present gitdir file targets for
direct state/open/status queries so broken submodule checkouts are reported
if the gitlink doesn't point to a directory.
For status ignore=all, still parse valid gitdir files to keep state accurate,
but skip target validation and fall back without error if the gitdir file itself
is malformed or unreadable. Derive State::is_old_form directly from whether
the worktree .git path is a directory so a divergent modern gitlink is not
misclassified as old form.
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
0 commit comments