diff --git a/src/status.coffee b/src/status.coffee index 0e35eaf..2ebe241 100644 --- a/src/status.coffee +++ b/src/status.coffee @@ -10,12 +10,16 @@ module.exports = S = (repo, callback) -> return callback err, status -BEGIN_STAGED = "# Changes to be committed:" +BEGIN_STAGED = [ + "# Changes to be committed:" +] BEGIN_UNSTAGED = [ "# Changed but not updated:" "# Changes not staged for commit:" ] -BEGIN_UNTRACKED = "# Untracked files:" +BEGIN_UNTRACKED = [ + "# Untracked files:" +] FILE = /^#\s+([^\s]+)[:]\s+(.+)$/ TYPES = added: "A" @@ -31,13 +35,13 @@ S.Status = class Status @clean = true state = null for line in text.split("\n") - if line == BEGIN_STAGED + if ~BEGIN_STAGED.indexOf(line) state = "staged" @clean = false else if ~BEGIN_UNSTAGED.indexOf(line) state = "unstaged" @clean = false - else if line == BEGIN_UNTRACKED + else if ~BEGIN_UNTRACKED.indexOf(line) state = "untracked" @clean = false else if state && match = FILE.exec(line)