Closed
Conversation
Two issues prevented the extension from working in git worktrees: 1. `path.join(dir, absolutePath)` produced a mangled path when the worktree's .git file contained an absolute gitdir path. Changed to `path.resolve(dir, path)` which handles both relative (submodules) and absolute (worktrees) paths correctly. 2. Worktree git directories (.git/worktrees/<name>) don't contain shared resources like refs/heads/, packed-refs, or config. Added resolution of the `commondir` file to find the shared .git directory, and use it for branch lookups, packed-refs, and config reads. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
I think the way this extension inspects If I find the time to make that change, git work trees should work too |
Owner
|
This is fixed in the latest release 4.0.0 via #75 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.gitfile, butpath.join(dir, absolutePath)concatenated them into an invalid path. Changed topath.resolve(dir, path)which correctly handles both relative (submodules) and absolute (worktrees) paths..git/worktrees/<name>) don't contain shared resources likerefs/heads/,packed-refs, orconfig. Added resolution of thecommondirfile that git places in worktree directories to find the shared.gitdirectory, and use it for branch lookups, packed-refs, and remote config reads.This fixes all commands (Blame on Main, Copy Main, Permalink, etc.) when used from a git worktree.
Test plan