mirror of
https://github.com/danog/gift.git
synced 2024-11-30 04:19:37 +01:00
fix Status#clean
This commit is contained in:
parent
b8bba251a4
commit
712928cd0a
@ -116,7 +116,7 @@ module.exports = class Repo
|
||||
|
||||
# Public: Get the repository's status (`git status`).
|
||||
#
|
||||
# callback - Receives `(err, callback)`
|
||||
# callback - Receives `(err, status)`
|
||||
#
|
||||
status: (callback) ->
|
||||
return Status(this, callback)
|
||||
|
@ -28,13 +28,15 @@ S.Status = class Status
|
||||
@clean = true
|
||||
state = null
|
||||
for line in text.split("\n")
|
||||
@clean = false
|
||||
if line == BEGIN_STAGED
|
||||
state = "staged"
|
||||
@clean = false
|
||||
else if line == BEGIN_UNSTAGED
|
||||
state = "unstaged"
|
||||
@clean = false
|
||||
else if line == BEGIN_UNTRACKED
|
||||
state = "untracked"
|
||||
@clean = false
|
||||
else if state && match = FILE.exec(line)
|
||||
file = match[2]
|
||||
data = switch state
|
||||
|
@ -22,9 +22,22 @@ GIT_STATUS = """
|
||||
#
|
||||
# pickles.txt
|
||||
"""
|
||||
GIT_STATUS_CLEAN = """
|
||||
# On branch master
|
||||
# nothing to commit (working directory clean)
|
||||
"""
|
||||
|
||||
describe "Status", ->
|
||||
describe "()", ->
|
||||
describe "when there are no changes", ->
|
||||
repo = fixtures.status
|
||||
status = new Status.Status repo
|
||||
status.parse GIT_STATUS_CLEAN
|
||||
|
||||
it "is clean", ->
|
||||
status.clean.should.be.true
|
||||
|
||||
|
||||
describe "when there are changes", ->
|
||||
repo = fixtures.status
|
||||
status = new Status.Status repo
|
||||
|
Loading…
Reference in New Issue
Block a user