From e82332ee9e140d8959d0b654d2b1c659641ea6d3 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 22 Nov 2021 12:49:21 -0500 Subject: [PATCH] Try to avoid trailing newline blame issues Resolves: https://github.com/tpope/vim-fugitive/issues/1892 --- autoload/fugitive.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index eed077e..6b9ef03 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -6771,9 +6771,13 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort elseif empty(files) && len(matchstr(s:DirCommitFile(@%)[1], '^\x\x\+$')) let cmd += [matchstr(s:DirCommitFile(@%)[1], '^\x\x\+$')] elseif empty(files) && !s:HasOpt(flags, '--reverse') - let cmd += ['--contents', tempname . '.in'] - silent execute 'noautocmd keepalt %write ' . s:fnameescape(tempname . '.in') - let delete_in = 1 + if &modified + let cmd += ['--contents', tempname . '.in'] + silent execute 'noautocmd keepalt %write ' . s:fnameescape(tempname . '.in') + let delete_in = 1 + elseif &autoread + exe 'checktime ' . bufnr('') + endif else call fugitive#Autowrite() endif