diff --git a/src/git-repository-async.js b/src/git-repository-async.js index 943a98841..668183ba7 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -1056,9 +1056,15 @@ export default class GitRepositoryAsync { } } + // TextBuffers will emit a reload event when they're first loaded. We don't + // need to refresh in that case. + let firstReload = true bufferSubscriptions.add( buffer.onDidSave(refreshStatusForBuffer), - buffer.onDidReload(refreshStatusForBuffer), + buffer.onDidReload(() => { + if (!firstReload) refreshStatusForBuffer() + firstReload = false + }), buffer.onDidChangePath(refreshStatusForBuffer), buffer.onDidDestroy(() => { bufferSubscriptions.dispose() diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 0513c2293..bc4f57161 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -448,7 +448,14 @@ class GitRepository bufferSubscriptions = new CompositeDisposable bufferSubscriptions.add buffer.onDidSave(getBufferPathStatus) - bufferSubscriptions.add buffer.onDidReload(getBufferPathStatus) + + # TextBuffers will emit a reload event when they're first loaded. We don't + # need to refresh in that case. + firstReload = true + bufferSubscriptions.add buffer.onDidReload(-> + getBufferPathStatus() unless firstReload + firstReload = false + ) bufferSubscriptions.add buffer.onDidChangePath(getBufferPathStatus) bufferSubscriptions.add buffer.onDidDestroy => bufferSubscriptions.dispose()