Commit 4fa183f4 authored by Jonas Bernoulli's avatar Jonas Bernoulli

Make non-local exits more obvious

Using `if' instead of `unless' was misleading - the THEN never
returned.
parent b0eab2e4
......@@ -287,10 +287,10 @@ optional NODISPLAY is non-nil also display it."
(interactive)
(magit-section-when process
(let ((process (oref it value)))
(if (eq (process-status process) 'run)
(when (magit-confirm 'kill-process)
(kill-process process))
(user-error "Process isn't running")))))
(unless (eq (process-status process) 'run)
(user-error "Process isn't running"))
(when (magit-confirm 'kill-process)
(kill-process process)))))
;;; Synchronous Processes
......
......@@ -507,26 +507,26 @@ edit. With a prefix argument the old message is reused as-is."
(defun magit-rebase-skip ()
"Skip the current commit and restart the current rebase operation."
(interactive)
(if (magit-rebase-in-progress-p)
(magit-run-git-sequencer "rebase" "--skip")
(user-error "No rebase in progress")))
(unless (magit-rebase-in-progress-p)
(user-error "No rebase in progress"))
(magit-run-git-sequencer "rebase" "--skip"))
;;;###autoload
(defun magit-rebase-edit ()
"Edit the todo list of the current rebase operation."
(interactive)
(if (magit-rebase-in-progress-p)
(magit-run-git-sequencer "rebase" "--edit-todo")
(user-error "No rebase in progress")))
(unless (magit-rebase-in-progress-p)
(user-error "No rebase in progress"))
(magit-run-git-sequencer "rebase" "--edit-todo"))
;;;###autoload
(defun magit-rebase-abort ()
"Abort the current rebase operation, restoring the original branch."
(interactive)
(if (magit-rebase-in-progress-p)
(when (magit-confirm 'abort-rebase "Abort this rebase")
(magit-run-git "rebase" "--abort"))
(user-error "No rebase in progress")))
(unless (magit-rebase-in-progress-p)
(user-error "No rebase in progress"))
(when (magit-confirm 'abort-rebase "Abort this rebase")
(magit-run-git "rebase" "--abort")))
(defun magit-rebase-in-progress-p ()
"Return t if a rebase is in progress."
......
......@@ -293,10 +293,10 @@ inspect the merge and change the commit message.
"Abort the current merge operation.
\n(git merge --abort)"
(interactive)
(if (file-exists-p (magit-git-dir "MERGE_HEAD"))
(when (magit-confirm 'abort-merge)
(magit-run-git-async "merge" "--abort"))
(user-error "No merge in progress")))
(unless (file-exists-p (magit-git-dir "MERGE_HEAD"))
(user-error "No merge in progress"))
(when (magit-confirm 'abort-merge)
(magit-run-git-async "merge" "--abort")))
(defun magit-checkout-stage (file arg)
"During a conflict checkout and stage side, or restore conflict."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment