     header = "@@ -#{oldStart},#{oldCount} +#{newStart},#{newCount} @@#{context}\n"
     patch = "#{header}#{lines.join("\n")}\n"
 
-    promise = if @status == 'unstaged'
+    promise = if action is 'stage'
       @gitIndex.stagePatch(patch, @patch.getRaw())
     else
       @gitIndex.unstagePatch(patch, @patch.getRaw())

      context:  headerParts[5]

  processLinesStage: ->
    action = if @status == 'unstaged' then 'stage' else 'unstage'
    path = @patch.newPathName

    totalChanges = @allChangedLines().length

    oldCount = newCount = 0

    lines = []

    selectedLineCount = @querySelectorAll(".hunk-line.selected").length
    stagedLineCount = @querySelectorAll(".hunk-line.selected.staged").length

    action = if stagedLineCount < selectedLineCount - stagedLineCount
      'stage'
    else
      'unstage'

    for line, idx in @hunk.lines
      selected =
