Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect work_dir for worktrees of submodules #1759

Closed
davidkna opened this issue Jan 11, 2025 · 1 comment · Fixed by #1762
Closed

Incorrect work_dir for worktrees of submodules #1759

davidkna opened this issue Jan 11, 2025 · 1 comment · Fixed by #1762
Assignees
Labels
acknowledged an issue is accepted as shortcoming to be fixed

Comments

@davidkna
Copy link
Contributor

davidkna commented Jan 11, 2025

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") }
@Byron Byron added the acknowledged an issue is accepted as shortcoming to be fixed label Jan 11, 2025
@Byron Byron self-assigned this Jan 11, 2025
@Byron
Copy link
Member

Byron commented Jan 12, 2025

Thanks a lot for reporting and for helping to reproduce the issue - fixing it that way was a breeze!

Unfortunately the fix will have to wait until the 22nd of January for when the next major release is scheduled. A patch release is already impossible due to breaking changes in at least one plumbing crate, unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged an issue is accepted as shortcoming to be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants