mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-21 07:58:04 +03:00
Remove git-status-changed event from Buffer
This is now fired as a status-changed event from the Git class when the checkout completes normally and the status of the path changes.
This commit is contained in:
parent
31690d16ec
commit
3852b7212b
@ -126,6 +126,17 @@ describe "Git", ->
|
||||
expect(fs.read(path2)).toBe('path 2 is edited')
|
||||
expect(repo.isPathModified(path2)).toBeTruthy()
|
||||
|
||||
it "fires a status-changed event if the checkout completes successfully", ->
|
||||
statusHandler = jasmine.createSpy('statusHandler')
|
||||
repo.on 'status-changed', statusHandler
|
||||
fs.write(path1, '')
|
||||
repo.checkoutHead(path1)
|
||||
expect(statusHandler.callCount).toBe 1
|
||||
expect(statusHandler.argsForCall[0][0..1]).toEqual [path1, 0]
|
||||
|
||||
repo.checkoutHead(path1)
|
||||
expect(statusHandler.callCount).toBe 1
|
||||
|
||||
describe ".destroy()", ->
|
||||
it "throws an exception when any method is called after it is called", ->
|
||||
repo = new Git(require.resolve('fixtures/git/master.git/HEAD'))
|
||||
|
@ -422,8 +422,7 @@ class Buffer
|
||||
checkoutHead: ->
|
||||
path = @getPath()
|
||||
return unless path
|
||||
if git?.checkoutHead(path)
|
||||
@trigger 'git-status-changed'
|
||||
git?.checkoutHead(path)
|
||||
|
||||
scheduleStoppedChangingEvent: ->
|
||||
clearTimeout(@stoppedChangingTimeout) if @stoppedChangingTimeout
|
||||
|
@ -114,7 +114,9 @@ class Git
|
||||
return head
|
||||
|
||||
checkoutHead: (path) ->
|
||||
@getRepo().checkoutHead(@relativize(path))
|
||||
headCheckedOut = @getRepo().checkoutHead(@relativize(path))
|
||||
@getPathStatus(path) if headCheckedOut
|
||||
headCheckedOut
|
||||
|
||||
getDiffStats: (path) ->
|
||||
@getRepo().getDiffStats(@relativize(path)) ? added: 0, deleted: 0
|
||||
|
@ -46,7 +46,6 @@ class StatusBarView extends View
|
||||
@buffer?.off '.status-bar'
|
||||
@buffer = @editor.getBuffer()
|
||||
@buffer.on 'contents-modified.status-bar', (e) => @updateBufferHasModifiedText(e.differsFromDisk)
|
||||
@buffer.on 'git-status-changed.status-bar', => @updateStatusBar()
|
||||
@updateStatusBar()
|
||||
|
||||
updateStatusBar: ->
|
||||
|
@ -153,14 +153,13 @@ describe "StatusBar", ->
|
||||
rootView.open(newPath)
|
||||
expect(statusBar.gitStatusIcon).toHaveClass('new-status-icon')
|
||||
|
||||
it "updates when a git-status-changed event occurs", ->
|
||||
it "updates when a status-changed event occurs", ->
|
||||
fs.write(path, "i've changed for the worse")
|
||||
git.getPathStatus(path)
|
||||
rootView.open(path)
|
||||
expect(statusBar.gitStatusIcon).toHaveClass('modified-status-icon')
|
||||
fs.write(path, originalPathText)
|
||||
git.getPathStatus(path)
|
||||
rootView.getActiveEditor().getBuffer().trigger 'git-status-changed'
|
||||
expect(statusBar.gitStatusIcon).not.toHaveClass('modified-status-icon')
|
||||
|
||||
it "displays the diff stat for modified files", ->
|
||||
|
@ -13,7 +13,6 @@ class Tab extends View
|
||||
@subscribe @buffer, 'path-changed', => @updateFileName()
|
||||
@subscribe @buffer, 'contents-modified', => @updateModifiedStatus()
|
||||
@subscribe @buffer, 'saved', => @updateModifiedStatus()
|
||||
@subscribe @buffer, 'git-status-changed', => @updateModifiedStatus()
|
||||
@subscribe @editor, 'editor:edit-session-added', => @updateFileName()
|
||||
@subscribe @editor, 'editor:edit-session-removed', => @updateFileName()
|
||||
@updateFileName()
|
||||
|
Loading…
Reference in New Issue
Block a user