Manually emit the change event.

This commit is contained in:
joshaber
2016-04-27 17:17:09 -04:00
parent 4727d6611e
commit d11e30579b

View File

@@ -166,10 +166,7 @@ class GitRepository
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
onDidChangeStatuses: (callback) ->
@async.onDidChangeStatuses =>
@branch = @async?.branch
@statusesByPath = {}
callback()
@emitter.on 'did-change-statuses', callback
###
Section: Repository Details
@@ -494,7 +491,23 @@ class GitRepository
#
# Returns a promise that resolves when the repository has been refreshed.
refreshStatus: ->
asyncRefresh = @async.refreshStatus()
statusesChanged = false
subscription = @async.onDidChangeStatuses ->
subscription?.dispose()
subscription = null
statusesChanged = true
asyncRefresh = @async.refreshStatus().then =>
subscription?.dispose()
subscription = null
@branch = @async?.branch
@statusesByPath = {}
if statusesChanged
@emitter.emit 'did-change-statuses'
syncRefresh = new Promise (resolve, reject) =>
@handlerPath ?= require.resolve('./repository-status-handler')