summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/km-magit.el21
1 files changed, 14 insertions, 7 deletions
diff --git a/lisp/km-magit.el b/lisp/km-magit.el
index a112099..c8b855a 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -837,13 +837,20 @@ COMMIT."
(list (or (and (not current-prefix-arg) atpoint)
(magit-read-branch-or-commit "Commit" atpoint)))))
(if (magit-rev-verify (concat commit "^{commit}"))
- (kill-new (message
- "%s"
- ;; Using `magit-git-string' instead of
- ;; `magit-rev-format' to pass --date flag.
- (magit-git-string "show" "-s" "--date=short"
- "--format=reference"
- commit "--")))
+ (kill-new
+ (message
+ "%s"
+ (replace-regexp-in-string
+ ;; Drop trailing period, if any, from the subject.
+ (rx (group ".") ", "
+ (repeat 4 digit) "-" (repeat 2 digit) "-" (repeat 2 digit)
+ ")" string-end)
+ ""
+ ;; Using `magit-git-string' instead of `magit-rev-format' to
+ ;; pass --date flag.
+ (magit-git-string "show" "-s" "--date=short" "--format=reference"
+ commit "--")
+ t t 1)))
(user-error "%s does not exist" commit)))
(defun km/magit-copy-commit-summary-from-header (&optional _)