Browse Source

Attempts to fix #2629 retries repo discovery

main
Eric Amodio 1 year ago
parent
commit
dae3ff4648
2 changed files with 15 additions and 4 deletions
  1. +1
    -1
      src/container.ts
  2. +14
    -3
      src/git/gitProviderService.ts

+ 1
- 1
src/container.ts View File

@ -297,7 +297,7 @@ export class Container {
this._disposables.push(this._git.register(provider.descriptor.id, provider)); this._disposables.push(this._git.register(provider.descriptor.id, provider));
} }
this._git.registrationComplete();
await this._git.registrationComplete();
} }
private onAnyConfigurationChanged(e: ConfigurationChangeEvent) { private onAnyConfigurationChanged(e: ConfigurationChangeEvent) {

+ 14
- 3
src/git/gitProviderService.ts View File

@ -10,6 +10,7 @@ import type {
WorkspaceFoldersChangeEvent, WorkspaceFoldersChangeEvent,
} from 'vscode'; } from 'vscode';
import { Disposable, EventEmitter, FileType, ProgressLocation, Uri, window, workspace } from 'vscode'; import { Disposable, EventEmitter, FileType, ProgressLocation, Uri, window, workspace } from 'vscode';
import { isWeb } from '@env/platform';
import { resetAvatarCache } from '../avatars'; import { resetAvatarCache } from '../avatars';
import type { CoreGitConfiguration } from '../constants'; import type { CoreGitConfiguration } from '../constants';
import { GlyphChars, Schemes } from '../constants'; import { GlyphChars, Schemes } from '../constants';
@ -494,14 +495,24 @@ export class GitProviderService implements Disposable {
private _initializing: boolean = true; private _initializing: boolean = true;
@log({ singleLine: true }) @log({ singleLine: true })
registrationComplete() {
async registrationComplete() {
const scope = getLogScope(); const scope = getLogScope();
this._initializing = false; this._initializing = false;
const { workspaceFolders } = workspace;
let { workspaceFolders } = workspace;
if (workspaceFolders?.length) { if (workspaceFolders?.length) {
void this.discoverRepositories(workspaceFolders);
await this.discoverRepositories(workspaceFolders);
// This is a hack to work around some issue with remote repositories on the web not being discovered on the initial load
if (this.repositoryCount === 0 && isWeb) {
setTimeout(() => {
({ workspaceFolders } = workspace);
if (workspaceFolders?.length) {
void this.discoverRepositories(workspaceFolders, { force: true });
}
}, 1000);
}
} else { } else {
this.updateContext(); this.updateContext();
} }

Loading…
Cancel
Save