Remove error handler from status BufReadCmd

The only error that should be possible here now is the version check, so
do that explicitly instead.
This commit is contained in:
Tim Pope
2024-01-29 22:52:19 -05:00
parent 3d9cace1ff
commit e3cdf27e19

View File

@@ -2714,6 +2714,7 @@ function! s:MapStatus() abort
endfunction
function! fugitive#BufReadStatus(cmdbang) abort
exe s:VersionCheck()
let amatch = s:Slash(expand('%:p'))
if a:cmdbang
unlet! b:fugitive_expanded
@@ -2752,7 +2753,7 @@ function! fugitive#BufReadStatus(cmdbang) abort
let head = FugitiveHead(11, dir)
elseif fugitive#Wait(status).exit_status
throw 'fugitive: ' . s:JoinChomp(status.stderr)
return 'echoerr ' . string('fugitive: ' . s:JoinChomp(status.stderr))
elseif status.args[-1] ==# '--porcelain=v2'
let output = split(tr(join(status.stdout, "\1"), "\1\n", "\n\1"), "\1", 1)[0:-2]
@@ -3033,8 +3034,6 @@ function! fugitive#BufReadStatus(cmdbang) abort
let b:fugitive_reltime = reltime()
return s:DoAutocmd('User FugitiveIndex')
catch /^fugitive:/
return 'echoerr ' . string(v:exception)
finally
let b:fugitive_type = 'index'
endtry
@@ -3102,7 +3101,6 @@ endfunction
function! fugitive#BufReadCmd(...) abort
let amatch = a:0 ? a:1 : expand('<amatch>')
try
let [dir, rev] = s:DirRev(amatch)
if empty(dir)
return 'echo "Invalid Fugitive URL"'
@@ -3110,7 +3108,9 @@ function! fugitive#BufReadCmd(...) abort
call s:InitializeBuffer(dir)
if rev ==# ':'
return fugitive#BufReadStatus(v:cmdbang)
elseif rev =~# '^:\d$'
endif
try
if rev =~# '^:\d$'
let b:fugitive_type = 'stage'
else
let r = fugitive#Execute([dir, 'cat-file', '-t', rev])