repository: Only report repo roots that form a real submodule chain - #1423
Open
huntie wants to merge 1 commit into
Open
repository: Only report repo roots that form a real submodule chain#1423huntie wants to merge 1 commit into
huntie wants to merge 1 commit into
Conversation
|
This pull request has been imported. If you are a Meta employee, you can view this in D117876027. (Because this pull request was imported automatically, there will not be any future comments.) |
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
Fixes an edge case when using ISL inside a VS Code workspace with nested (non-submodule) Git repos.
Example:
~/devroottracked with git, holdingprojects/react/andprojects/react-native/as independent clones.The UI suggests this is entirely supported — with one inner Git repo per configured workspace folder — and indeed the switching behaviour works.
However, ISL:
devroot) instead of the selected repo.Root cause
debugrootswalks up to the system root, so it reports every repo above the cwd, related or not.RepoInfo.repoRootspasses that through, but its consumers read it as a submodule chain:CwdSelectorlabels the button fromrepoRoots[0]and treatsrepoRoots.length > 1as "submodule breadcrumbs follow", which suppresses theButtonDropdown. Nothing renders in their place, because the outer repo has no submodules to offer.fetchSubmoduleMapalso queried the unrelated ancestors.Fix
Narrow the roots in
getRepoInfoto the innermost run where each root is a submodule of the one above it, so the most local repo always leads. Ancestors are dropped when they do not declare the root below them, and when their submodules cannot be listed at all — an olderslwithoutdebuggitmodulesalready renders no breadcrumbs, so truncating costs nothing there.Command count is unchanged in practice: the ancestors this drops are exactly the ones
fetchSubmoduleMapno longer has to query.Notes
The
fetchSubmoduleMap'nested' test mockeddebugrootsoutermost-first, the reverse of what the command emits. Order never mattered before, sincefetchSubmoduleMapiterates the list; it does now, so the mock is corrected.Test Plan
After this fix: