From 38cf3b8f649a051ab8afb149ae8246ebcaf01d82 Mon Sep 17 00:00:00 2001 From: joshaber Date: Wed, 2 Dec 2015 13:55:10 -0500 Subject: [PATCH] Use refreshStatusForBuffer. --- src/git-repository-async.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/git-repository-async.js b/src/git-repository-async.js index 00b325268..8e942ff1c 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -36,11 +36,8 @@ module.exports = class GitRepositoryAsync { this.project = project if (this.project) { - this.subscriptions.add(this.project.onDidAddBuffer(buffer => { - this.subscribeToBuffer(buffer) - })) - - this.project.getBuffers().forEach(buffer => { this.subscribeToBuffer(buffer) }) + this.project.getBuffers().forEach(buffer => this.subscribeToBuffer(buffer)) + this.subscriptions.add(this.project.onDidAddBuffer(buffer => this.subscribeToBuffer(buffer))) } } @@ -214,7 +211,7 @@ module.exports = class GitRepositoryAsync { subscribeToBuffer (buffer) { const bufferSubscriptions = new CompositeDisposable() - const getBufferPathStatus = () => { + const refreshStatusForBuffer = () => { const _path = buffer.getPath() if (_path) { this.refreshStatusForPath(_path) @@ -222,9 +219,9 @@ module.exports = class GitRepositoryAsync { } bufferSubscriptions.add( - buffer.onDidSave(getBufferPathStatus), - buffer.onDidReload(getBufferPathStatus), - buffer.onDidChangePath(getBufferPathStatus), + buffer.onDidSave(refreshStatusForBuffer), + buffer.onDidReload(refreshStatusForBuffer), + buffer.onDidChangePath(refreshStatusForBuffer), buffer.onDidDestroy(() => { bufferSubscriptions.dispose() this.subscriptions.remove(bufferSubscriptions)