mirror of
https://github.com/atom/atom.git
synced 2026-01-26 15:28:27 -05:00
Remove confirmation from git-repo-async to match git-repo
cf https://github.com/atom/atom/commit/f9a269ed995c4151678aef787573fe44657e d6dd
This commit is contained in:
@@ -90,36 +90,19 @@ module.exports = class GitRepositoryAsync {
|
||||
}
|
||||
|
||||
checkoutHeadForEditor (editor) {
|
||||
var filePath = editor.getPath()
|
||||
if (!filePath) {
|
||||
return Promise.reject('editor.filePath() is empty')
|
||||
}
|
||||
|
||||
var fileName = path.basename(filePath)
|
||||
var checkoutHead = () => {
|
||||
if (editor.buffer.isModified()) {
|
||||
editor.buffer.reload()
|
||||
}
|
||||
return this.checkoutHead(filePath)
|
||||
}
|
||||
|
||||
var confirmCheckout = function () {
|
||||
// This is bad tho
|
||||
return Promise.resolve(atom.confirm({
|
||||
message: 'Confirm Checkout HEAD Revision',
|
||||
detailedMessage: `Are you sure you want to discard all changes to "${fileName}" since the last Git commit?`,
|
||||
buttons: {
|
||||
OK: checkoutHead,
|
||||
Cancel: null
|
||||
return new Promise(function (resolve, reject) {
|
||||
var filePath = editor.getPath()
|
||||
if (filePath) {
|
||||
if (editor.buffer.isModified()) {
|
||||
editor.buffer.reload()
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
if (atom.config.get('editor.confirmCheckoutHeadRevision')) {
|
||||
return confirmCheckout()
|
||||
} else {
|
||||
return checkoutHead()
|
||||
}
|
||||
resolve(filePath)
|
||||
} else {
|
||||
reject()
|
||||
}
|
||||
}).then((filePath) => {
|
||||
return this.checkoutHead(filePath)
|
||||
})
|
||||
}
|
||||
|
||||
// Returns a Promise that resolves to the status bit of a given path if it has
|
||||
|
||||
Reference in New Issue
Block a user