From 5304951d4cd2c4bc98ed204ba928533f9d80c56a Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Tue, 1 Sep 2015 11:42:30 -0400 Subject: Rewrite magit-copy-commit-summary --- lisp/init-git.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lisp/init-git.el') diff --git a/lisp/init-git.el b/lisp/init-git.el index a8190b9..29525a5 100644 --- a/lisp/init-git.el +++ b/lisp/init-git.el @@ -381,10 +381,14 @@ COMMIT." (magit-tag-at-point)))) (list (or (and (not current-prefix-arg) atpoint) (magit-read-branch-or-commit "Commit" atpoint))))) - (cl-destructuring-bind (hash subject date) - (magit-git-lines "show" "-s" "--date=short" - "--format=%h\n%s\n%ad" commit) - (kill-new (message "%s (\"%s\", %s)" hash subject date)))) + (if (magit-rev-verify (concat commit "^{commit}")) + (kill-new (message + ;; Using `magit-git-string' instead of + ;; `magit-rev-format' to pass --date flag. + (magit-git-string "show" "-s" "--date=short" + "--format=%h (\"%s\", %ad)" + commit "--"))) + (user-error "%s does not exist" commit))) (defun km/magit-copy-commit-summary-from-header (&optional arg) (magit-section-when headers -- cgit v1.2.3