diff --git a/extensions/git/package.json b/extensions/git/package.json index bea5f96a67d..ba28f10b18c 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1644,7 +1644,17 @@ "default": true }, "git.autofetch": { - "type": "boolean", + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "enum": [ + "all" + ] + } + ], "scope": "resource", "description": "%config.autofetch%", "default": false, diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 6158a7e0cd5..7d7576f4419 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -97,7 +97,7 @@ "config.autoRepositoryDetection.subFolders": "Scan for subfolders of the currently opened folder.", "config.autoRepositoryDetection.openEditors": "Scan for parent folders of open files.", "config.autorefresh": "Whether auto refreshing is enabled.", - "config.autofetch": "When enabled, commits will automatically be fetched from the default remote of the current Git repository.", + "config.autofetch": "When set to true, commits will automatically be fetched from the default remote of the current Git repository. Setting to `all` will fetch from all remotes", "config.autofetchPeriod": "Duration in seconds between each automatic git fetch, when `git.autofetch` is enabled.", "config.confirmSync": "Confirm before synchronizing git repositories.", "config.countBadge": "Controls the Git count badge.", diff --git a/extensions/git/src/autofetch.ts b/extensions/git/src/autofetch.ts index d9e436b9f5c..d4ff1ef1e49 100644 --- a/extensions/git/src/autofetch.ts +++ b/extensions/git/src/autofetch.ts @@ -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('autofetch') === false) { - this.disable(); - } else { - this.enable(); + switch (gitConfig.get('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();