mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 12:33:35 +01:00
Changing autofetch to a string config which has "current", "all" and (#111090)
This commit is contained in:
@@ -23,6 +23,7 @@ export class AutoFetcher {
|
||||
private onDidChange = this._onDidChange.event;
|
||||
|
||||
private _enabled: boolean = false;
|
||||
private _fetchAll: boolean = false;
|
||||
get enabled(): boolean { return this._enabled; }
|
||||
set enabled(enabled: boolean) { this._enabled = enabled; this._onDidChange.fire(enabled); }
|
||||
|
||||
@@ -70,10 +71,20 @@ export class AutoFetcher {
|
||||
private onConfiguration(): void {
|
||||
const gitConfig = workspace.getConfiguration('git', Uri.file(this.repository.root));
|
||||
|
||||
if (gitConfig.get<boolean>('autofetch') === false) {
|
||||
this.disable();
|
||||
} else {
|
||||
this.enable();
|
||||
switch (gitConfig.get<boolean | 'all'>('autofetch')) {
|
||||
case true:
|
||||
this._fetchAll = false;
|
||||
this.enable();
|
||||
break;
|
||||
case 'all':
|
||||
this._fetchAll = true;
|
||||
this.enable();
|
||||
break;
|
||||
case false:
|
||||
default:
|
||||
this._fetchAll = false;
|
||||
this.disable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +110,11 @@ export class AutoFetcher {
|
||||
}
|
||||
|
||||
try {
|
||||
await this.repository.fetchDefault({ silent: true });
|
||||
if (this._fetchAll) {
|
||||
await this.repository.fetchAll();
|
||||
} else {
|
||||
await this.repository.fetchDefault({ silent: true });
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.gitErrorCode === GitErrorCodes.AuthenticationFailed) {
|
||||
this.disable();
|
||||
|
||||
Reference in New Issue
Block a user