diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2026-03-30 22:32:02 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2026-03-30 22:32:02 +0200 |
| commit | 5e4bbaff36d57af75e224445faaec27352be9084 (patch) | |
| tree | 7142d9961a33790af6b9b1de731c5dbc045fecab | |
| parent | 46b7f76df3d8983a60f60ca862b4d65e99989094 (diff) | |
magit-commit-diff--{args,show}: New functions
Split up `magit-commit-diff-1'.
| -rw-r--r-- | lisp/magit-commit.el | 15 | ||||
| -rw-r--r-- | lisp/magit-diff.el | 4 |
2 files changed, 11 insertions, 8 deletions
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el index a8c9aaf..912127b 100644 --- a/lisp/magit-commit.el +++ b/lisp/magit-commit.el @@ -684,10 +684,10 @@ an alternative implementation." (let ((inhibit-quit nil)) (condition-case nil (with-demoted-errors "Error showing commit diff: %S" - (magit-commit-diff-1)) + (magit-commit-diff--show)) (quit))))) -(defun magit-commit-diff-1 () +(defun magit-commit-diff--args () (let ((rev nil) (arg "--cached") (command (magit-repository-local-get 'this-commit-command)) @@ -736,10 +736,13 @@ an alternative implementation." ((or squash (file-exists-p (expand-file-name "rebase-merge/amend" (magit-gitdir)))) (setq rev "HEAD^")) - (t - (message "No alternative diff while committing") - (setq noalt t))) - (unless noalt + ((setq noalt t))) + (list rev arg noalt))) + +(defun magit-commit-diff--show () + (pcase-let ((`(,rev ,arg ,noalt) (magit-commit-diff--args))) + (if noalt + (message "No alternative diff while committing") (let ((magit-inhibit-save-previous-winconf 'unset) (magit-display-buffer-noselect t) (display-buffer-overriding-action diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el index d4d06f3..9d46576 100644 --- a/lisp/magit-diff.el +++ b/lisp/magit-diff.el @@ -47,7 +47,7 @@ ;; For `magit-diff-wash-diff' (defvar magit-log-heading-re) ;; For `magit-diff-while-committing' -(declare-function magit-commit-diff-1 "magit-commit" ()) +(declare-function magit-commit-diff--show "magit-commit" ()) (declare-function magit-commit-message-buffer "magit-commit" ()) ;; For `magit-insert-revision-gravatar' (defvar gravatar-size) @@ -1490,7 +1490,7 @@ be committed." (interactive) (unless (magit-commit-message-buffer) (user-error "No commit in progress")) - (magit-commit-diff-1)) + (magit-commit-diff--show)) ;;;###autoload (defun magit-diff-buffer-file () |
