Rewrite aborting. (R)
This commit is contained in:
parent
8897b0552c
commit
8460d4db78
1 changed files with 17 additions and 1 deletions
18
magit.el
18
magit.el
|
@ -273,11 +273,15 @@ Many Magit faces inherit from this one by default."
|
|||
(magit-commit-at-point t))
|
||||
|
||||
(defun magit-file-uptodate-p (file)
|
||||
(eq (magit-shell-exit-code "git diff --quiet %s" file) 0))
|
||||
(eq (magit-shell-exit-code "git diff --quiet -- %s" file) 0))
|
||||
|
||||
(defun magit-anything-staged-p ()
|
||||
(not (eq (magit-shell-exit-code "git diff --quiet --cached") 0)))
|
||||
|
||||
(defun magit-everything-clean-p ()
|
||||
(and (not (magit-anything-staged-p))
|
||||
(eq (magit-shell-exit-code "git diff --quiet") 0)))
|
||||
|
||||
;;; Sections
|
||||
|
||||
;; A buffer in magit-mode isorganized into hierarchical sections.
|
||||
|
@ -1286,6 +1290,18 @@ Please see the manual for a complete description of Magit.
|
|||
"\n"))))
|
||||
(insert "\n"))))
|
||||
|
||||
(defun magit-rewrite-abort ()
|
||||
(interactive)
|
||||
(let* ((info (magit-read-rewrite-info))
|
||||
(orig (cadr (assq 'orig info))))
|
||||
(or info
|
||||
(error "No rewrite in progress."))
|
||||
(or (magit-everything-clean-p)
|
||||
(error "You have uncommitted changes. Abort aborted."))
|
||||
(when (yes-or-no-p "Abort rewrite? ")
|
||||
(magit-write-rewrite-info nil)
|
||||
(magit-run "git" "reset" "--hard" orig))))
|
||||
|
||||
;;; Updating, pull, and push
|
||||
|
||||
(defun magit-remote-update ()
|
||||
|
|
Loading…
Reference in a new issue