Skip to content

Resolve follows sybmolic link and mangles submodule pathing #2422

@kangasp

Description

@kangasp

This is an edge case I had the painful pleasure of finding today.
If there is a submodule at the same depth in the project, as the super project is to a matching symlink, then the pathing to the submodule can break.

Example setup:

Super project home:

  • /home/user/git_things/my_project/src_repo

Add a submodule to the project at a path that matches a symlink in the system at the right depth:

  • /home/user/git_things/my_project/src_repo/lib/utl/helpers

Make sure you have a matching symlink:

ls -alh /home/user/git_things/my_project/src_repo/../../../../../lib
/home/user/git_things/my_project/src_repo/../../../../../lib -> usr/lib

If all these conditions are met, then fugitive.vim:: s:Tree() will use resolve on the worktree and corrupt it. Something like this:
'../../../../../lib/utl/helpers' --> '../../../../../usr/lib/utl/helpers'
And then, sad sad, no more nice git blame windows for that submodule.

This is on a Linux WSL2 system.
Sorry no patch. I don't feel familiar enough with what could break by messing with the resolve cmd.

Relates to: #2397

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions