From 9bb8703978e9438bbc84bd15b3f76aeb45c06896 Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 3 Dec 2015 09:49:10 -0500 Subject: [PATCH] Don't make the async repo duplicate the work if it's wrapped by a sync repo. --- src/git-repository-async.js | 4 ++-- src/git-repository.coffee | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/git-repository-async.js b/src/git-repository-async.js index 614d18a26..2c86c129d 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -41,9 +41,9 @@ export default class GitRepositoryAsync { this.subscriptions.add(new Disposable(() => window.removeEventListener('focus', onWindowFocus))) } - const {project} = options + const {project, subscribeToBuffers} = options this.project = project - if (this.project) { + if (this.project && subscribeToBuffers) { this.project.getBuffers().forEach(buffer => this.subscribeToBuffer(buffer)) this.subscriptions.add(this.project.onDidAddBuffer(buffer => this.subscribeToBuffer(buffer))) } diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 30cce92d0..5a0df6743 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -76,7 +76,14 @@ class GitRepository unless @repo? throw new Error("No Git repository found searching path: #{path}") - @async = GitRepositoryAsync.open(path, options) + asyncOptions = {} + for key, val of options + asyncOptions[key] = val + # GitRepository itself will handle these cases by manually calling through + # to the async repo. + asyncOptions.refreshOnWindowFocus = false + asyncOptions.subscribeToBuffers = false + @async = GitRepositoryAsync.open(path, asyncOptions) @statuses = {} @upstream = {ahead: 0, behind: 0}