mirror of
https://github.com/danog/gift.git
synced 2025-01-21 21:41:13 +01:00
handle multiple "unstaged" messages
This commit is contained in:
parent
a84da5dfda
commit
7f158c4813
@ -11,7 +11,10 @@ module.exports = S = (repo, callback) ->
|
||||
|
||||
|
||||
BEGIN_STAGED = "# Changes to be committed:"
|
||||
BEGIN_UNSTAGED = "# Changed but not updated:"
|
||||
BEGIN_UNSTAGED = [
|
||||
"# Changed but not updated:"
|
||||
"# Changes not staged for commit:"
|
||||
]
|
||||
BEGIN_UNTRACKED = "# Untracked files:"
|
||||
FILE = /^#\s+([^\s]+)[:]\s+(.+)$/
|
||||
TYPES =
|
||||
@ -31,7 +34,7 @@ S.Status = class Status
|
||||
if line == BEGIN_STAGED
|
||||
state = "staged"
|
||||
@clean = false
|
||||
else if line == BEGIN_UNSTAGED
|
||||
else if ~BEGIN_UNSTAGED.indexOf(line)
|
||||
state = "unstaged"
|
||||
@clean = false
|
||||
else if line == BEGIN_UNTRACKED
|
||||
|
@ -26,6 +26,17 @@ GIT_STATUS_CLEAN = """
|
||||
# On branch master
|
||||
# nothing to commit (working directory clean)
|
||||
"""
|
||||
GIT_STATUS_NOT_CLEAN = """
|
||||
# On branch master
|
||||
# Changes not staged for commit:
|
||||
# (use "git add ..." to update what will be committed)
|
||||
# (use "git checkout -- ..." to discard changes in working directory)
|
||||
#
|
||||
# modified: lib/index.js
|
||||
# modified: npm-shrinkwrap.json
|
||||
# modified: package.json
|
||||
#
|
||||
"""
|
||||
|
||||
describe "Status", ->
|
||||
describe "()", ->
|
||||
@ -37,7 +48,13 @@ describe "Status", ->
|
||||
it "is clean", ->
|
||||
status.clean.should.be.true
|
||||
|
||||
|
||||
describe "when there are changes", ->
|
||||
repo = fixtures.status
|
||||
status = new Status.Status repo
|
||||
status.parse GIT_STATUS_NOT_CLEAN
|
||||
it "is not clean", ->
|
||||
status.clean.should.be.false
|
||||
|
||||
describe "when there are changes", ->
|
||||
repo = fixtures.status
|
||||
status = new Status.Status repo
|
||||
|
Loading…
x
Reference in New Issue
Block a user