branch: elpa/magit
commit 02432355c508a4df97247592954b12c026199427
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-read-reuse-message: With a prefix argument select from log
Closes #5602.
---
docs/CHANGELOG.4 | 5 +++++
lisp/magit-commit.el | 19 +++++++++++++------
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/docs/CHANGELOG.4 b/docs/CHANGELOG.4
index e8d9a5a71b..ae62d52096 100644
--- a/docs/CHANGELOG.4
+++ b/docs/CHANGELOG.4
@@ -39,6 +39,11 @@
- By default, submodules with untracked content are now also listed
the status of the super-repository. #5448
+- Added ~--redit-message~ to the ~magit-commit~ menu. That argument and
+ ~--reuse-message~ now usually default to the commit at point, but when
+ invoked with a prefix argument, the user can instead selected the
+ commit from a log. #5602
+
Bugfixes:
- ~magit-ignore-submodules-p~ didn't return ~nil~ for ~none~.
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index 79d8d75bdb..6ec8619ff3 100644
--- a/lisp/magit-commit.el
+++ b/lisp/magit-commit.el
@@ -187,12 +187,19 @@ manpage for details.")
:history-key 'magit-revision-history)
(defun magit-read-reuse-message (prompt &optional default history)
- (magit-completing-read prompt (magit-list-refnames)
- nil nil nil history
- (or default
- (magit-commit-at-point)
- (and (magit-rev-verify "ORIG_HEAD")
- "ORIG_HEAD"))))
+ (if current-prefix-arg
+ (let (rev)
+ (magit-log-select
+ (lambda (r) (setq rev r) (exit-recursive-edit))
+ "Type %p on a commit to reuse its message")
+ (recursive-edit)
+ rev)
+ (magit-completing-read prompt (magit-list-refnames)
+ nil nil nil history
+ (or default
+ (magit-commit-at-point)
+ (and (magit-rev-verify "ORIG_HEAD")
+ "ORIG_HEAD")))))
;;; Commands
;;;; Create