diff options
author | Kyle Meyer <kyle@kyleam.com> | 2015-09-01 11:42:30 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-09-01 11:42:30 -0400 |
commit | 5304951d4cd2c4bc98ed204ba928533f9d80c56a (patch) | |
tree | c019d6b30e8f16e1656e009bc02b46330a074369 | |
parent | 2c04fe5ec1c87ccb16b0d32bfe0b58f8e2978afe (diff) | |
download | emacs.d-5304951d4cd2c4bc98ed204ba928533f9d80c56a.tar.gz |
Rewrite magit-copy-commit-summary
-rw-r--r-- | lisp/init-git.el | 12 |
1 files changed, 8 insertions, 4 deletions
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 |