branch: elpa/magit commit abb86c6a39fd1b1c8d59fb288f907bb60c6cc11d Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-commit-squash-internal: Reduce nesting --- lisp/magit-commit.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el index be32e0af16c..b6fb250a7a7 100644 --- a/lisp/magit-commit.el +++ b/lisp/magit-commit.el @@ -292,13 +292,12 @@ depending on the value of option `magit-commit-squash-confirm'." (defun magit-commit-squash-internal (option commit &optional args rebase edit confirmed) (when-let ((args (magit-commit-assert args (not edit)))) - (when commit - (when (and rebase (not (magit-rev-ancestor-p commit "HEAD"))) - (magit-read-char-case - (format "%s isn't an ancestor of HEAD. " commit) nil - (?c "[c]reate without rebasing" (setq rebase nil)) - (?s "[s]elect other" (setq commit nil)) - (?a "[a]bort" (user-error "Quit"))))) + (when (and commit rebase (not (magit-rev-ancestor-p commit "HEAD"))) + (magit-read-char-case + (format "%s isn't an ancestor of HEAD. " commit) nil + (?c "[c]reate without rebasing" (setq rebase nil)) + (?s "[s]elect other" (setq commit nil)) + (?a "[a]bort" (user-error "Quit")))) (when commit (setq commit (magit-rebase-interactive-assert commit t))) (if (and commit