Fixes terminal commit links in multi-repository workspaces#5196
Open
qianxunslimg wants to merge 1 commit into
Open
Fixes terminal commit links in multi-repository workspaces#5196qianxunslimg wants to merge 1 commit into
qianxunslimg wants to merge 1 commit into
Conversation
e9e0556 to
0238dbc
Compare
e9e0556 to
7bd0a92
Compare
bf97134 to
e9e0556
Compare
e9e0556 to
1296091
Compare
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.
Description
Problem
In workspaces with multiple Git repositories, such as projects with nested repositories or submodules, terminal commit links can fail to resolve through GitLens.
When this happens, commit SHAs printed in terminal output are not handled by GitLens and VS Code can fall back to other link providers, such as file search results.
Root Cause
GitTerminalLinkProvidercurrently relies oncontainer.git.highlanderto determine the repository for terminal links. In multi-repository workspaces,highlanderis undefined, so terminal links cannot be created even when the terminal has a clear working directory.Commit SHA links are also validated asynchronously before being returned. If that validation is cancelled, a valid commit SHA can be dropped before GitLens creates a terminal link.
Fix
This change resolves the repository for terminal links by:
highlanderbehavior when there is a single repositorygetOrOpenRepository(..., { detectNested: true })It also creates commit SHA terminal links once a repository path has been resolved, avoiding cancellation-prone validation before returning the link.
Branch, tag, and range link behavior is preserved.
Testing
pnpm exec eslint src/terminal/linkProvider.tspnpm exec tsc --noEmit --project tsconfig.jsongit log --onelinecommit SHAs open through GitLens instead of falling back to VS Code file search.Checklist
Fixes $XXX -orCloses #XXX -prefix to auto-close the issue that your PR addresses