[BUG FIX] Inconsistency in how Git Repositories were disposed when wo…#284139
Open
Rushali-Sarkar wants to merge 1 commit intomicrosoft:mainfrom
Open
[BUG FIX] Inconsistency in how Git Repositories were disposed when wo…#284139Rushali-Sarkar wants to merge 1 commit intomicrosoft:mainfrom
Rushali-Sarkar wants to merge 1 commit intomicrosoft:mainfrom
Conversation
…rkspace folders were removed. Specifically, repositories were being kept alive if a file from that repository was still open in an editor. This caused the Source Control view to continue showing repositories whose backing workspace folders had already been removed. To address this, I: 1. Removed the activeRepositories guard that prevented disposal of repositories associated with removed workspace folders. 2. Ensured repository disposal is now driven purely by workspace folder membership, so the SCM view immediately reflects workspace changes. This change fixes the issue where removed workspace folders left behind stale repositories in SCM.
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
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 #108757
Problem Description
When working in a multi-root workspace containing multiple Git repositories, VS Code does not immediately update the Source Control (SCM) view after a workspace folder is removed if that repository has uncommitted changes.
Specifically, removing a folder from the workspace correctly updates the Explorer, but the corresponding Git repository remains visible in the SCM pane, including its uncommitted changes. The SCM view only reflects the correct state after the workspace is reopened.
This results in a temporary but confusing inconsistency between the Explorer and the Source Control view.
Expected Behaviour
When a folder is removed from the workspace:
Actual Behaviour
Steps to Reproduce
Summary
In a multi-root workspace, the SCM view does not immediately synchronise with workspace folder removal when the removed repository contains uncommitted changes, leading to a transient but incorrect UI state.
Change-log:
Corrected Inconsistency in how Git repositories were disposed when workspace folders were removed.
Specifically, repositories were being kept alive if a file from that repository was still open in an editor. This caused the Source Control view to continue showing repositories whose backing workspace folders had already been removed.
To address this, I:
This change fixes the issue where removed workspace folders left behind stale repositories in SCM.
“Do not keep repositories around simply because an editor is open on a file from that repository. If the workspace folder backing the repository is removed from the workspace, the repository should be disposed so the SCM view immediately reflects the workspace state.”
Changed
vscode/extensions/git/src/model.ts-FROM
TO