diff --git a/extensions/git/package.json b/extensions/git/package.json index a6aefcf6679..c9b7a5b2c17 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -364,6 +364,11 @@ "configuration": { "title": "Git", "properties": { + "git.autorefresh": { + "type": "boolean", + "description": "%config.autorefresh%", + "default": true + }, "git.autofetch": { "type": "boolean", "description": "%config.autofetch%", diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 13290309fe8..bb240bc50d8 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -23,5 +23,6 @@ "command.sync": "Sync", "command.publish": "Publish", "command.showOutput": "Show Git Output", + "config.autorefresh": "Whether auto refreshing is enabled.", "config.autofetch": "Whether auto fetching is enabled." } \ No newline at end of file diff --git a/extensions/git/src/model.ts b/extensions/git/src/model.ts index e7b3e3e2398..9631eeed23a 100644 --- a/extensions/git/src/model.ts +++ b/extensions/git/src/model.ts @@ -5,7 +5,7 @@ 'use strict'; -import { Uri, EventEmitter, Event, SCMResource, SCMResourceDecorations, SCMResourceGroup, Disposable, window } from 'vscode'; +import { Uri, EventEmitter, Event, SCMResource, SCMResourceDecorations, SCMResourceGroup, Disposable, window, workspace } from 'vscode'; import { Repository, IRef, IBranch, IRemote, IPushOptions } from './git'; import { anyEvent, eventToPromise, filterEvent, mapEvent } from './util'; import { memoize, throttle, debounce } from './decorators'; @@ -449,6 +449,13 @@ export class Model { } private onFSChange(uri: Uri): void { + const config = workspace.getConfiguration('git'); + const autorefresh = config.get('autorefresh'); + + if (!autorefresh) { + return; + } + if (!this.operations.isIdle()) { return; }