From f417e4c8e96e0f08150a314afc128160fbca42b1 Mon Sep 17 00:00:00 2001 From: Jesse Byler Date: Wed, 27 Sep 2023 01:25:35 -0700 Subject: [PATCH] Issue #2217 Include commit hash and refs in commit display When displaying a commit, add a new line showing the commit hash and refs description. Also switches from using `git cat-file commit` to using `git show --no-patch` for the short form toggled with `a` or `i` to keep the format consistent. --- autoload/fugitive.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index ba574490be..c7e917a29e 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3174,9 +3174,10 @@ function! fugitive#BufReadCmd(...) abort elseif b:fugitive_type ==# 'commit' let b:fugitive_display_format = b:fugitive_display_format % 2 if b:fugitive_display_format - call s:ReplaceCmd([dir, 'cat-file', b:fugitive_type, rev]) + " call s:ReplaceCmd([dir, 'cat-file', b:fugitive_type, rev]) + call s:ReplaceCmd([dir, '-c', 'diff.noprefix=false', '-c', 'log.showRoot=false', 'show', '--no-color', '-m', '--first-parent', '--no-patch', '--pretty=format:commit%x20%H%d%ntree%x20%T%nparent%x20%P%nauthor%x20%an%x20<%ae>%x20%ad%ncommitter%x20%cn%x20<%ce>%x20%cd%n%n%s%n%n%b', rev]) else - call s:ReplaceCmd([dir, '-c', 'diff.noprefix=false', '-c', 'log.showRoot=false', 'show', '--no-color', '-m', '--first-parent', '--pretty=format:tree%x20%T%nparent%x20%P%nauthor%x20%an%x20<%ae>%x20%ad%ncommitter%x20%cn%x20<%ce>%x20%cd%nencoding%x20%e%n%n%s%n%n%b', rev]) + call s:ReplaceCmd([dir, '-c', 'diff.noprefix=false', '-c', 'log.showRoot=false', 'show', '--no-color', '-m', '--first-parent', '--pretty=format:commit%x20%H%d%ntree%x20%T%nparent%x20%P%nauthor%x20%an%x20<%ae>%x20%ad%ncommitter%x20%cn%x20<%ce>%x20%cd%nencoding%x20%e%n%n%s%n%n%b', rev]) keepjumps 1 keepjumps call search('^parent ') if getline('.') ==# 'parent '