mirror of
https://github.com/atom/atom.git
synced 2026-02-15 17:15:24 -05:00
Consolidate Git status checking
Now the status bar and tree view both listen for status change events and use the cached information available from the git object to update their views.
This commit is contained in:
@@ -38,6 +38,13 @@ class Git
|
||||
@refreshIndex()
|
||||
@refreshStatus()
|
||||
|
||||
project?.eachBuffer this, (buffer) =>
|
||||
bufferStatusHandler = =>
|
||||
path = buffer.getPath()
|
||||
@getPathStatus(path) if path
|
||||
@subscribe buffer, 'saved', bufferStatusHandler
|
||||
@subscribe buffer, 'reloaded', bufferStatusHandler
|
||||
|
||||
getRepo: ->
|
||||
unless @repo?
|
||||
throw new Error("Repository has been destroyed")
|
||||
|
||||
@@ -128,9 +128,15 @@ class Project
|
||||
buffers.push editSession.buffer
|
||||
buffers
|
||||
|
||||
eachBuffer: (callback) ->
|
||||
eachBuffer: (args...) ->
|
||||
subscriber = args.shift() if args.length > 1
|
||||
callback = args.shift()
|
||||
|
||||
callback(buffer) for buffer in @getBuffers()
|
||||
@on 'buffer-created', (buffer) -> callback(buffer)
|
||||
if subscriber
|
||||
subscriber.subscribe this, 'buffer-created', (buffer) -> callback(buffer)
|
||||
else
|
||||
@on 'buffer-created', (buffer) -> callback(buffer)
|
||||
|
||||
bufferForPath: (filePath) ->
|
||||
if filePath?
|
||||
|
||||
@@ -69,9 +69,11 @@ window.shutdown = ->
|
||||
rootView: rootView.serialize()
|
||||
rootView.deactivate()
|
||||
project.destroy()
|
||||
git?.destroy()
|
||||
$(window).off('focus blur before')
|
||||
window.rootView = null
|
||||
window.project = null
|
||||
window.git = null
|
||||
|
||||
window.installAtomCommand = (commandPath) ->
|
||||
return if fs.exists(commandPath)
|
||||
|
||||
Reference in New Issue
Block a user