Skip to content

Commit 348a658

Browse files
authored
Git - Show progress while doing the initial repository discovery (microsoft#165695)
Show progress while doing the initial repository discovery
1 parent ed1bc56 commit 348a658

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

extensions/git/src/model.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { workspace, WorkspaceFoldersChangeEvent, Uri, window, Event, EventEmitter, QuickPickItem, Disposable, SourceControl, SourceControlResourceGroup, TextEditor, Memento, commands, LogOutputChannel, l10n } from 'vscode';
6+
import { workspace, WorkspaceFoldersChangeEvent, Uri, window, Event, EventEmitter, QuickPickItem, Disposable, SourceControl, SourceControlResourceGroup, TextEditor, Memento, commands, LogOutputChannel, l10n, ProgressLocation } from 'vscode';
77
import TelemetryReporter from '@vscode/extension-telemetry';
88
import { Operation, Repository, RepositoryState } from './repository';
99
import { memoize, sequentialize, debounce } from './decorators';
@@ -130,14 +130,20 @@ export class Model implements IRemoteSourcePublisherRegistry, IPostCommitCommand
130130
}
131131

132132
private async doInitialScan(): Promise<void> {
133-
await Promise.all([
133+
const config = workspace.getConfiguration('git');
134+
const autoRepositoryDetection = config.get<boolean | 'subFolders' | 'openEditors'>('autoRepositoryDetection');
135+
136+
const initialScanFn = () => Promise.all([
134137
this.onDidChangeWorkspaceFolders({ added: workspace.workspaceFolders || [], removed: [] }),
135138
this.onDidChangeVisibleTextEditors(window.visibleTextEditors),
136139
this.scanWorkspaceFolders()
137140
]);
138141

139-
const config = workspace.getConfiguration('git');
140-
const autoRepositoryDetection = config.get<boolean | 'subFolders' | 'openEditors'>('autoRepositoryDetection');
142+
if (config.get<boolean>('showProgress', true)) {
143+
await window.withProgress({ location: ProgressLocation.SourceControl }, initialScanFn);
144+
} else {
145+
await initialScanFn();
146+
}
141147

142148
/* __GDPR__
143149
"git.repositoryInitialScan" : {

0 commit comments

Comments
 (0)