Function: magit-commit-squash-internal
magit-commit-squash-internal is a byte-compiled function defined in
magit-commit.el.
Signature
(magit-commit-squash-internal OPTION COMMIT &optional ARGS NOPATCH EDIT REBASE CONFIRMED)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-commit.el
;;;; Internal
(defun magit-commit-squash-internal
(option commit &optional args nopatch edit rebase confirmed)
(when-let ((args (magit-commit-assert args nopatch (not edit))))
(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
(or confirmed
(not (or rebase
current-prefix-arg
magit-commit-squash-confirm))))
(let ((magit-commit-show-diff nil))
(push (concat option commit) args)
(push (if edit "--edit" "--no-edit") args)
(if rebase
(magit-with-editor
(magit-call-git
"commit" "--no-gpg-sign"
(seq-remove (apply-partially #'string-prefix-p "--gpg-sign=")
args)))
(magit-run-git-with-editor "commit" args))
t) ; The commit was created; used by below lambda.
(let ((winconf (and magit-commit-show-diff
(current-window-configuration))))
(magit-log-select
(lambda (commit)
(when (and (magit-commit-squash-internal option commit args
nopatch edit rebase t)
rebase)
(magit-commit-amend-assert commit)
(magit-rebase-interactive-1 commit
(list "--autosquash" "--autostash" "--keep-empty")
"" "true" nil t))
(when winconf
(set-window-configuration winconf)))
(format "Type %%p on a commit to %s into it,"
(substring option 2))
nil nil nil commit))
(when (and magit-commit-show-diff (not nopatch))
(let ((magit-display-buffer-noselect t))
(apply #'magit-diff-staged nil (magit-diff-arguments)))))))