set git.mergeChanges context key for all repos, not just one (#162339)

fixes https://github.com/microsoft/vscode/issues/162224
This commit is contained in:
Johannes Rieken
2022-09-29 14:50:07 +02:00
committed by GitHub
parent 187f099e91
commit a2fe848791
2 changed files with 16 additions and 4 deletions

View File

@@ -450,7 +450,21 @@ export class Model implements IRemoteSourcePublisherRegistry, IPostCommitCommand
.forEach(p => this.eventuallyScanPossibleGitRepository(p));
};
const statusListener = repository.onDidRunGitStatus(checkForSubmodules);
const updateMergeChanges = () => {
// set mergeChanges context
const mergeChanges: Uri[] = [];
for (const { repository } of this.openRepositories.values()) {
for (const state of repository.mergeGroup.resourceStates) {
mergeChanges.push(state.resourceUri);
}
}
commands.executeCommand('setContext', 'git.mergeChanges', mergeChanges);
};
const statusListener = repository.onDidRunGitStatus(() => {
checkForSubmodules();
updateMergeChanges();
});
checkForSubmodules();
const dispose = () => {
@@ -466,6 +480,7 @@ export class Model implements IRemoteSourcePublisherRegistry, IPostCommitCommand
const openRepository = { repository, dispose };
this.openRepositories.push(openRepository);
updateMergeChanges();
this._onDidOpenRepository.fire(repository);
}