           oid: oid
           path: newPath
           fileSize: buffer.length
-          mode: patch.newFile().mode()
+          mode: fileDiff.getMode()
 
       data.index.removeByPath(oldPath) if oldPath != newPath
       data.index.add(entry)

          oid: oid
          path: newPath
          fileSize: buffer.length
          mode: patch.newFile().mode()
        data.index.add(entry)
        data.index.write()
    .then =>

      console.log error.message
      console.log error.stack

  unstagePatch: (fileDiff, patchText) =>
    patchText = @reversePatch(patchText)

    data = {}
    oldPath = fileDiff.getOldPathName()
    newPath = fileDiff.getNewPathName()
    Git.Repository.open(@repoPath)
    .then (repo) ->
      data.repo = repo
