mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-11 04:48:44 +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(fs.read(path2)).toBe('path 2 is edited')
|
||||||
expect(repo.isPathModified(path2)).toBeTruthy()
|
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()", ->
|
describe ".destroy()", ->
|
||||||
it "throws an exception when any method is called after it is called", ->
|
it "throws an exception when any method is called after it is called", ->
|
||||||
repo = new Git(require.resolve('fixtures/git/master.git/HEAD'))
|
repo = new Git(require.resolve('fixtures/git/master.git/HEAD'))
|
||||||
|
@ -422,8 +422,7 @@ class Buffer
|
|||||||
checkoutHead: ->
|
checkoutHead: ->
|
||||||
path = @getPath()
|
path = @getPath()
|
||||||
return unless path
|
return unless path
|
||||||
if git?.checkoutHead(path)
|
git?.checkoutHead(path)
|
||||||
@trigger 'git-status-changed'
|
|
||||||
|
|
||||||
scheduleStoppedChangingEvent: ->
|
scheduleStoppedChangingEvent: ->
|
||||||
clearTimeout(@stoppedChangingTimeout) if @stoppedChangingTimeout
|
clearTimeout(@stoppedChangingTimeout) if @stoppedChangingTimeout
|
||||||
|
@ -114,7 +114,9 @@ class Git
|
|||||||
return head
|
return head
|
||||||
|
|
||||||
checkoutHead: (path) ->
|
checkoutHead: (path) ->
|
||||||
@getRepo().checkoutHead(@relativize(path))
|
headCheckedOut = @getRepo().checkoutHead(@relativize(path))
|
||||||
|
@getPathStatus(path) if headCheckedOut
|
||||||
|
headCheckedOut
|
||||||
|
|
||||||
getDiffStats: (path) ->
|
getDiffStats: (path) ->
|
||||||
@getRepo().getDiffStats(@relativize(path)) ? added: 0, deleted: 0
|
@getRepo().getDiffStats(@relativize(path)) ? added: 0, deleted: 0
|
||||||
|
@ -46,7 +46,6 @@ class StatusBarView extends View
|
|||||||
@buffer?.off '.status-bar'
|
@buffer?.off '.status-bar'
|
||||||
@buffer = @editor.getBuffer()
|
@buffer = @editor.getBuffer()
|
||||||
@buffer.on 'contents-modified.status-bar', (e) => @updateBufferHasModifiedText(e.differsFromDisk)
|
@buffer.on 'contents-modified.status-bar', (e) => @updateBufferHasModifiedText(e.differsFromDisk)
|
||||||
@buffer.on 'git-status-changed.status-bar', => @updateStatusBar()
|
|
||||||
@updateStatusBar()
|
@updateStatusBar()
|
||||||
|
|
||||||
updateStatusBar: ->
|
updateStatusBar: ->
|
||||||
|
@ -153,14 +153,13 @@ describe "StatusBar", ->
|
|||||||
rootView.open(newPath)
|
rootView.open(newPath)
|
||||||
expect(statusBar.gitStatusIcon).toHaveClass('new-status-icon')
|
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")
|
fs.write(path, "i've changed for the worse")
|
||||||
git.getPathStatus(path)
|
git.getPathStatus(path)
|
||||||
rootView.open(path)
|
rootView.open(path)
|
||||||
expect(statusBar.gitStatusIcon).toHaveClass('modified-status-icon')
|
expect(statusBar.gitStatusIcon).toHaveClass('modified-status-icon')
|
||||||
fs.write(path, originalPathText)
|
fs.write(path, originalPathText)
|
||||||
git.getPathStatus(path)
|
git.getPathStatus(path)
|
||||||
rootView.getActiveEditor().getBuffer().trigger 'git-status-changed'
|
|
||||||
expect(statusBar.gitStatusIcon).not.toHaveClass('modified-status-icon')
|
expect(statusBar.gitStatusIcon).not.toHaveClass('modified-status-icon')
|
||||||
|
|
||||||
it "displays the diff stat for modified files", ->
|
it "displays the diff stat for modified files", ->
|
||||||
|
@ -13,7 +13,6 @@ class Tab extends View
|
|||||||
@subscribe @buffer, 'path-changed', => @updateFileName()
|
@subscribe @buffer, 'path-changed', => @updateFileName()
|
||||||
@subscribe @buffer, 'contents-modified', => @updateModifiedStatus()
|
@subscribe @buffer, 'contents-modified', => @updateModifiedStatus()
|
||||||
@subscribe @buffer, 'saved', => @updateModifiedStatus()
|
@subscribe @buffer, 'saved', => @updateModifiedStatus()
|
||||||
@subscribe @buffer, 'git-status-changed', => @updateModifiedStatus()
|
|
||||||
@subscribe @editor, 'editor:edit-session-added', => @updateFileName()
|
@subscribe @editor, 'editor:edit-session-added', => @updateFileName()
|
||||||
@subscribe @editor, 'editor:edit-session-removed', => @updateFileName()
|
@subscribe @editor, 'editor:edit-session-removed', => @updateFileName()
|
||||||
@updateFileName()
|
@updateFileName()
|
||||||
|
Loading…
Reference in New Issue
Block a user