From 906c12a2b096fb0d9dd1b5800465de5bd5d8f47b Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Mon, 11 Jul 2016 12:30:00 +0200 Subject: [PATCH] add git.autorefresh setting fixes #901 --- src/vs/workbench/parts/git/browser/gitServices.ts | 8 +++++++- .../parts/git/browser/gitWorkbenchContributions.ts | 5 +++++ src/vs/workbench/parts/git/common/git.ts | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/git/browser/gitServices.ts b/src/vs/workbench/parts/git/browser/gitServices.ts index eddd41c288b..c79eaa8dfc1 100644 --- a/src/vs/workbench/parts/git/browser/gitServices.ts +++ b/src/vs/workbench/parts/git/browser/gitServices.ts @@ -404,7 +404,7 @@ export class GitService extends ee.EventEmitter private reactiveStatusDelayer: async.PeriodThrottledDelayer; private autoFetcher: AutoFetcher; private isStatusPending = false; - private isFocused = false; + private isFocused = true; private _allowHugeRepositories: boolean; get allowHugeRepositories(): boolean { return this._allowHugeRepositories; } @@ -613,6 +613,12 @@ export class GitService extends ee.EventEmitter this.isStatusPending = false; + const config = this.configurationService.getConfiguration('git'); + + if (!config.autorefresh) { + return; + } + this.reactiveStatusDelayer.trigger(() => this.status()).done(null, e => { if (errors.isPromiseCanceledError(e)) { return; diff --git a/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts b/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts index 0a4f9fc7506..fd944a2d67b 100644 --- a/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts +++ b/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts @@ -523,6 +523,11 @@ export function registerContributions(): void { description: nls.localize('gitPath', "Path to the git executable"), default: null }, + 'git.autorefresh': { + type: 'boolean', + description: nls.localize('gitAutoRefresh', "Whether auto refreshing is enabled"), + default: true + }, 'git.autofetch': { type: 'boolean', description: nls.localize('gitAutoFetch', "Whether auto fetching is enabled."), diff --git a/src/vs/workbench/parts/git/common/git.ts b/src/vs/workbench/parts/git/common/git.ts index 8e50183d165..7f7268e1249 100644 --- a/src/vs/workbench/parts/git/common/git.ts +++ b/src/vs/workbench/parts/git/common/git.ts @@ -230,6 +230,7 @@ export var ServiceOperations = { export interface IGitConfiguration { enabled: boolean; path: string; + autorefresh: boolean; autofetch: boolean; enableLongCommitWarning: boolean; allowLargeRepositories: boolean; -- GitLab