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`).
|
# Public: Get the repository's status (`git status`).
|
||||||
#
|
#
|
||||||
# callback - Receives `(err, callback)`
|
# callback - Receives `(err, status)`
|
||||||
#
|
#
|
||||||
status: (callback) ->
|
status: (callback) ->
|
||||||
return Status(this, callback)
|
return Status(this, callback)
|
||||||
|
@ -28,13 +28,15 @@ S.Status = class Status
|
|||||||
@clean = true
|
@clean = true
|
||||||
state = null
|
state = null
|
||||||
for line in text.split("\n")
|
for line in text.split("\n")
|
||||||
@clean = false
|
|
||||||
if line == BEGIN_STAGED
|
if line == BEGIN_STAGED
|
||||||
state = "staged"
|
state = "staged"
|
||||||
|
@clean = false
|
||||||
else if line == BEGIN_UNSTAGED
|
else if line == BEGIN_UNSTAGED
|
||||||
state = "unstaged"
|
state = "unstaged"
|
||||||
|
@clean = false
|
||||||
else if line == BEGIN_UNTRACKED
|
else if line == BEGIN_UNTRACKED
|
||||||
state = "untracked"
|
state = "untracked"
|
||||||
|
@clean = false
|
||||||
else if state && match = FILE.exec(line)
|
else if state && match = FILE.exec(line)
|
||||||
file = match[2]
|
file = match[2]
|
||||||
data = switch state
|
data = switch state
|
||||||
|
@ -22,9 +22,22 @@ GIT_STATUS = """
|
|||||||
#
|
#
|
||||||
# pickles.txt
|
# pickles.txt
|
||||||
"""
|
"""
|
||||||
|
GIT_STATUS_CLEAN = """
|
||||||
|
# On branch master
|
||||||
|
# nothing to commit (working directory clean)
|
||||||
|
"""
|
||||||
|
|
||||||
describe "Status", ->
|
describe "Status", ->
|
||||||
describe "()", ->
|
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", ->
|
describe "when there are changes", ->
|
||||||
repo = fixtures.status
|
repo = fixtures.status
|
||||||
status = new Status.Status repo
|
status = new Status.Status repo
|
||||||
|
Loading…
Reference in New Issue
Block a user