Get path status after checkout

This commit is contained in:
Daniel Hengeveld
2015-10-20 17:03:08 +02:00
parent 8ff31bd3dc
commit 4c0c732766
2 changed files with 18 additions and 8 deletions

View File

@@ -195,17 +195,25 @@ describe "GitRepositoryAsync", ->
runs ->
expect(fs.readFileSync(filePath, 'utf8')).toBe ''
xit "fires a status-changed event if the checkout completes successfully", ->
it "fires a did-change-status event if the checkout completes successfully", ->
fs.writeFileSync(filePath, 'ch ch changes')
repo.getPathStatus(filePath)
statusHandler = jasmine.createSpy('statusHandler')
repo.onDidChangeStatus statusHandler
repo.checkoutHead(filePath)
expect(statusHandler.callCount).toBe 1
expect(statusHandler.argsForCall[0][0]).toEqual {path: filePath, pathStatus: 0}
repo.checkoutHead(filePath)
expect(statusHandler.callCount).toBe 1
waitsForPromise ->
repo.getPathStatus(filePath)
runs ->
repo.onDidChangeStatus statusHandler
waitsForPromise ->
repo.checkoutHead(filePath)
runs ->
expect(statusHandler.callCount).toBe 1
expect(statusHandler.argsForCall[0][0]).toEqual {path: filePath, pathStatus: 0}
waitsForPromise ->
repo.checkoutHead(filePath)
runs ->
expect(statusHandler.callCount).toBe 1
xdescribe ".checkoutHeadForEditor(editor)", ->
[filePath, editor] = []

View File

@@ -84,6 +84,8 @@ module.exports = class GitRepositoryAsync {
checkoutOptions.paths = [this._gitUtilsRepo.relativize(_path)]
checkoutOptions.checkoutStrategy = Git.Checkout.STRATEGY.FORCE | Git.Checkout.STRATEGY.DISABLE_PATHSPEC_MATCH
return Git.Checkout.head(repo, checkoutOptions)
}).then(() => {
return this.getPathStatus(_path)
})
}