From 81dbc5c867cc88b7b01663656ce19890136cc16e Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 3 Dec 2015 09:48:38 -0500 Subject: [PATCH] Move the refreshingCount changes closer to where the work is done. --- src/git-repository-async.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/git-repository-async.js b/src/git-repository-async.js index 705f98870..614d18a26 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -350,7 +350,10 @@ export default class GitRepositoryAsync { return status }) - .then(_ => this._refreshingCount--) + .then(status => { + this._refreshingCount-- + return status + }) } // Returns a Promise that resolves to the status bit of a given path if it has @@ -491,6 +494,8 @@ export default class GitRepositoryAsync { } _refreshStatus () { + this._refreshingCount++ + return this.repoPromise .then(repo => repo.getStatus()) .then(statuses => { @@ -506,22 +511,21 @@ export default class GitRepositoryAsync { this.pathStatusCache = newPathStatusCache return newPathStatusCache }) + .then(_ => this._refreshingCount--) } // Refreshes the git status. // - // Returns :: Promise + // Returns :: Promise // Resolves when refresh has completed. refreshStatus () { - this._refreshingCount++ - // TODO add submodule tracking const status = this._refreshStatus() const branch = this._refreshBranch() const aheadBehind = branch.then(branchName => this._refreshAheadBehindCount(branchName)) - return Promise.all([status, branch, aheadBehind]).then(_ => this._refreshingCount--) + return Promise.all([status, branch, aheadBehind]).then(_ => null) } // Section: Private