From 7a3499688634432df5ab29bd65c9a576734098ee Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 11 Aug 2021 12:50:40 -0400 Subject: [PATCH] Use jobs for FileReadCmd --- autoload/fugitive.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 0936043..b9f11af 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -2464,11 +2464,18 @@ function! fugitive#FileReadCmd(...) abort return 'noautocmd ' . line . 'read ' . s:fnameescape(amatch) endif if rev !~# ':' && s:ChompDefault('', [dir, 'cat-file', '-t', rev]) =~# '^\%(commit\|tag\)$' - let cmd = fugitive#ShellCommand([dir, 'log', '--pretty=format:%B', '-1', rev, '--']) + let cmd = [dir, 'log', '--pretty=format:%B', '-1', rev, '--'] else - let cmd = fugitive#ShellCommand([dir, 'cat-file', '-p', rev, '--']) + let cmd = [dir, 'cat-file', '-p', rev, '--'] + endif + let temp = tempname() + let [err, exec_error] = s:StdoutToFile(temp, cmd) + if exec_error + call delete(temp) + return 'noautocmd ' . line . 'read ' . s:fnameescape(amatch) + else + return 'silent keepalt ' . line . 'read ' . s:fnameescape(temp) . '|call delete(' . string(temp) . ')' endif - return line . 'read !' . escape(cmd, '!#%') endfunction function! fugitive#FileWriteCmd(...) abort