Skip to content

Incorrect work_dir for worktrees of submodules #1759

Closed
@davidkna

Description

@davidkna

Current behavior 😯

The work_dir for worktrees of submodules is resolved to .git/modules/.... instead of the git-worktree directory.
For the example the discovered work_dir is .git/modules/temp-submod. I think the issue stems from somewhere in open_from_paths.

Reported via starship/starship#6417

Expected behavior 🤔

Discovered work_dir is temp-wt directory

Git behavior

Matches expected behavior

Steps to reproduce 🕹


git init
touch Readme.md
git commit -m "c"

git submodule add https://github.com/GitoxideLabs/gitoxide temp-submod
cd temp-submod
git worktree add ../../temp-wt
cd ../../temp-wt
# discover
# Repository { kind: Submodule, git_dir: "base-repo/.git/modules/temp-submod/worktrees/temp-wt", work_dir: Some("base-repo/.git/modules/temp-submod") }

Metadata

Metadata

Assignees

Labels

acknowledgedan issue is accepted as shortcoming to be fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions