mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Add confirmation dialog to checkoutHead
There have been a few reports of files mysteriously going back to the last version in the tree. My theory is that it is because of people fat-fingering the Undo command because the default keyboard mapping is too similar. This will at least prevent most accidental data loss.
This commit is contained in:
@@ -436,8 +436,14 @@ class Editor extends Model
|
||||
saveAs: (filePath) -> @buffer.saveAs(filePath)
|
||||
|
||||
checkoutHead: ->
|
||||
if filePath = @getPath()
|
||||
atom.project.getRepo()?.checkoutHead(filePath)
|
||||
if (filePath = @getPath()) and (repo = atom.project.getRepo())
|
||||
atom.confirm
|
||||
message: "Are you sure you want to revert this file to the last Git commit?"
|
||||
detailedMessage: "You are reverting: #{filePath}"
|
||||
buttons:
|
||||
"Revert": ->
|
||||
repo.checkoutHead(filePath)
|
||||
"Cancel": null
|
||||
|
||||
# Copies the current file path to the native clipboard.
|
||||
copyPathToClipboard: ->
|
||||
|
||||
Reference in New Issue
Block a user