Skip to content

Commit f18b29e

Browse files
committed
fix(scm): 🐛 do not await git repo status, just give the repo straight up to scm
on repo discovery, the git extension would run `git status` and wait for that to finish before handing out the repository to scm. this was problematic since the scm default repo selection depends on repos being discovered in a timely fashion. there's no reason not to just hand out the repo to scm and let `git status` finish afterwards Closes: microsoft#120089 Closes: microsoft#113803
1 parent 1c230ef commit f18b29e

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

extensions/git/src/model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export class Model implements IRemoteSourceProviderRegistry, IPushErrorHandlerRe
300300
const repository = new Repository(this.git.open(repositoryRoot, dotGit), this, this, this.globalState, this.outputChannel);
301301

302302
this.open(repository);
303-
await repository.status();
303+
repository.status(); // do not await this, we want SCM to know about the repo asap
304304
} catch (ex) {
305305
// noop
306306
this.outputChannel.appendLine(`Opening repository for path='${repoPath}' failed; ex=${ex}`);

src/vs/workbench/contrib/scm/browser/scmViewService.ts

+1-10
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ export class SCMViewService implements ISCMViewService {
100100
constructor(
101101
@ISCMService private readonly scmService: ISCMService,
102102
@IInstantiationService instantiationService: IInstantiationService,
103-
@IStorageService private readonly storageService: IStorageService,
104-
@ILogService private readonly logService: ILogService
103+
@IStorageService private readonly storageService: IStorageService
105104
) {
106105
this.menus = instantiationService.createInstance(SCMMenus);
107106

@@ -123,8 +122,6 @@ export class SCMViewService implements ISCMViewService {
123122
}
124123

125124
private onDidAddRepository(repository: ISCMRepository): void {
126-
this.logService.trace('SCMViewService#onDidAddRepository', getProviderStorageKey(repository.provider));
127-
128125
if (!this.didFinishLoading) {
129126
this.eventuallyFinishLoading();
130127
}
@@ -135,8 +132,6 @@ export class SCMViewService implements ISCMViewService {
135132
const index = this.previousState.all.indexOf(getProviderStorageKey(repository.provider));
136133

137134
if (index === -1) { // saw a repo we did not expect
138-
this.logService.trace('SCMViewService#onDidAddRepository', 'This is a new repository, so we stop the heuristics');
139-
140135
const added: ISCMRepository[] = [];
141136
for (const repo of this.scmService.repositories) { // all should be visible
142137
if (!this._visibleRepositoriesSet.has(repo)) {
@@ -179,8 +174,6 @@ export class SCMViewService implements ISCMViewService {
179174
}
180175

181176
private onDidRemoveRepository(repository: ISCMRepository): void {
182-
this.logService.trace('SCMViewService#onDidRemoveRepository', getProviderStorageKey(repository.provider));
183-
184177
if (!this.didFinishLoading) {
185178
this.eventuallyFinishLoading();
186179
}
@@ -257,7 +250,6 @@ export class SCMViewService implements ISCMViewService {
257250

258251
@debounce(2000)
259252
private eventuallyFinishLoading(): void {
260-
this.logService.trace('SCMViewService#eventuallyFinishLoading');
261253
this.finishLoading();
262254
}
263255

@@ -266,7 +258,6 @@ export class SCMViewService implements ISCMViewService {
266258
return;
267259
}
268260

269-
this.logService.trace('SCMViewService#finishLoading');
270261
this.didFinishLoading = true;
271262
this.previousState = undefined;
272263
}

0 commit comments

Comments
 (0)