diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2017-11-17 14:14:28 +0100 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2017-11-17 14:14:28 +0100 |
| commit | 88910e686adcb1d480cded614643b430cc298a9c (patch) | |
| tree | 7edd8d4af29d836e40d501665a66a2796fd577a6 /lisp/magit-diff.el | |
| parent | d83a1157fb4f1f54a539de76c5b882d86a00b66b (diff) | |
magit-show-commit: also show notes specified by notes.displayRef
Closes #2857.
Diffstat (limited to 'lisp/magit-diff.el')
| -rw-r--r-- | lisp/magit-diff.el | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el index a268ad9..4c9dce8 100644 --- a/lisp/magit-diff.el +++ b/lisp/magit-diff.el @@ -1951,17 +1951,26 @@ or a ref which is not a branch, then it inserts nothing." (defun magit-insert-revision-notes (rev) "Insert commit notes into a revision buffer." - (magit-insert-section (notes) - (let ((beg (point))) - (magit-git-insert "notes" "show" rev) - (if (= (point) beg) - (magit-cancel-section) - (goto-char beg) - (forward-line) - (put-text-property beg (point) 'face 'magit-section-secondary-heading) - (magit-insert-heading) - (goto-char (point-max)) - (insert ?\n))))) + (let* ((var "core.notesRef") + (def (or (magit-get var) "refs/notes/commits"))) + (dolist (ref (or (magit-list-active-notes-refs))) + (magit-insert-section (notes ref (not (equal ref def))) + (let ((beg (point))) + (magit-git-insert "-c" (concat "core.notesRef=" ref) + "notes" "show" rev) + (if (= (point) beg) + (magit-cancel-section) + (goto-char beg) + (end-of-line) + (put-text-property beg (point) 'face 'magit-section-secondary-heading) + (insert (format " (%s)" + (propertize (if (string-prefix-p "refs/notes/" ref) + (substring ref 11) + ref) + 'face 'magit-refname))) + (magit-insert-heading) + (goto-char (point-max)) + (insert ?\n))))))) (defun magit-insert-revision-headers (rev) "Insert headers about the commit into a revision buffer." |
