feat: resolve target repo from active editor and submodules#20
Open
plungarini wants to merge 3 commits into
Open
feat: resolve target repo from active editor and submodules#20plungarini wants to merge 3 commits into
plungarini wants to merge 3 commits into
Conversation
Replaces the showWorkspaceFolderPick-based selectRepo with a resolver backed by the vscode.git extension API. Resolution order: 1. Repository owning the currently focused editor. 2. Single repository workspace, that one. 3. QuickPick over all repos and submodules when ambiguous. The previous implementation only fired for multi-root workspaces with 2+ folders, and could never see submodules since showWorkspaceFolderPick only knows about workspace folders. As a result, commands always targeted the top-level repo even when the user was working inside a submodule. Note: flow.gitDir in flow.ts is still computed at module load from workspace.rootPath. It is only used by the in-progress merge tracking file (MERGE_BASE) during feature finish. Out of scope here, will need a follow-up. Closes anhthang#19
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.
Closes #19
Replaces the
showWorkspaceFolderPick-basedselectRepowith a resolver backed by thevscode.gitextension API. This fixes the long-standing issue where gitflow commands always targeted the top-level repository, even when the user was working inside a submodule.Resolution order
Why the previous implementation didn't work for submodules
vscode.window.showWorkspaceFolderPickonly enumerates workspace folders, so submodules are invisible to it. It also only fires when there are 2+ workspace folders, meaning a typical single-folder workspace with submodules silently fell through tovscode.workspace.rootPathincmd.ts, which is always the top-level repo.Manual testing
Known related issue, not addressed here
flow.gitDirinsrc/flow.tsis computed once at module load fromvscode.workspace.rootPath. It's used by the in-progress merge tracking file (MERGE_BASE) duringfeature finish. Same root-cause family but a wider change.