mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 14:23:51 -05:00
Avoid intermediary v:errmsg in exception handling
This commit is contained in:
@@ -63,8 +63,7 @@ function! s:fnameescape(file) abort
|
||||
endfunction
|
||||
|
||||
function! s:throw(string) abort
|
||||
let v:errmsg = 'fugitive: '.a:string
|
||||
throw v:errmsg
|
||||
throw 'fugitive: '.a:string
|
||||
endfunction
|
||||
|
||||
function! s:warn(str) abort
|
||||
@@ -1627,7 +1626,7 @@ function! fugitive#BufReadStatus() abort
|
||||
|
||||
return ''
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
@@ -1791,7 +1790,7 @@ function! fugitive#BufReadCmd(...) abort
|
||||
return 'silent doautocmd' . (v:version >= 704 ? ' <nomodeline>' : '') .
|
||||
\ ' BufReadPost' . (modifiable ? '' : '|setl nomodifiable')
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
@@ -1961,7 +1960,7 @@ function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args
|
||||
return mods . (a:count > 0 ? a:count : '') . 'split' . arg
|
||||
endif
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
return ''
|
||||
endfunction
|
||||
@@ -2280,7 +2279,7 @@ function! s:Do(action, visual) abort
|
||||
endif
|
||||
let success = 1
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
finally
|
||||
if reload
|
||||
execute s:ReloadStatus()
|
||||
@@ -2515,7 +2514,7 @@ function! s:StageDelete(lnum, count) abort
|
||||
try
|
||||
call s:StageApply(info, 1, info.section ==# 'Staged' ? ['--index'] : [])
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
elseif a:count == 2
|
||||
call s:TreeChomp('checkout', '--ours', '--', info.paths[0])
|
||||
@@ -2658,7 +2657,7 @@ function! s:StagePatch(lnum1,lnum2) abort
|
||||
execute "Git reset --patch -- ".join(map(reset,'s:shellesc(v:val)'))
|
||||
endif
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
return s:ReloadStatus()
|
||||
endfunction
|
||||
@@ -2742,7 +2741,7 @@ function! s:CommitCommand(line1, line2, range, count, bang, mods, reg, arg, args
|
||||
endif
|
||||
endif
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
finally
|
||||
if exists('old_editor')
|
||||
let $GIT_EDITOR = old_editor
|
||||
@@ -3221,7 +3220,7 @@ function! s:Open(cmd, bang, mods, arg, args) abort
|
||||
let [file, pre] = s:OpenParse(a:args)
|
||||
let file = s:Generate(file)
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
if file !~# '^\a\a\+:'
|
||||
let file = s:sub(file, '/$', '')
|
||||
@@ -3260,7 +3259,7 @@ function! s:ReadCommand(line1, line2, range, count, bang, mods, reg, arg, args)
|
||||
let [file, pre] = s:OpenParse(a:args)
|
||||
let file = s:Generate(file)
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
if file =~# '^fugitive:' && after is# 0
|
||||
return 'exe ' .string(mods . fugitive#FileReadCmd(file, 0, pre)) . '|diffupdate'
|
||||
@@ -3650,7 +3649,7 @@ function! s:Diff(vert,keepfocus,...) abort
|
||||
try
|
||||
let file = fugitive#RevParse(arg).s:Relative(':')
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
else
|
||||
let file = s:Expand(arg)
|
||||
@@ -3685,7 +3684,7 @@ function! s:Diff(vert,keepfocus,...) abort
|
||||
endif
|
||||
return post
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
@@ -3918,7 +3917,7 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args)
|
||||
endtry
|
||||
return ''
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
@@ -4278,7 +4277,7 @@ function! s:BrowseCommand(line1, line2, range, count, bang, mods, reg, arg, args
|
||||
endif
|
||||
endif
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
@@ -4602,7 +4601,7 @@ function! s:GF(mode) abort
|
||||
try
|
||||
let results = &filetype ==# 'fugitive' ? s:StatusCfile() : &filetype ==# 'gitcommit' ? [s:MessageCfile()] : s:cfile()
|
||||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
return 'echoerr ' . string(v:exception)
|
||||
endtry
|
||||
if len(results) > 1
|
||||
return 'G' . a:mode .
|
||||
|
||||
Reference in New Issue
Block a user