Don't make the async repo duplicate the work if it's wrapped by a sync repo.

This commit is contained in:
joshaber
2015-12-03 09:49:10 -05:00
parent 81dbc5c867
commit 9bb8703978
2 changed files with 10 additions and 3 deletions

View File

@@ -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)))
}

View File

@@ -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}