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
|
endfunction
|
||||||
|
|
||||||
function! s:throw(string) abort
|
function! s:throw(string) abort
|
||||||
let v:errmsg = 'fugitive: '.a:string
|
throw 'fugitive: '.a:string
|
||||||
throw v:errmsg
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:warn(str) abort
|
function! s:warn(str) abort
|
||||||
@@ -1627,7 +1626,7 @@ function! fugitive#BufReadStatus() abort
|
|||||||
|
|
||||||
return ''
|
return ''
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -1791,7 +1790,7 @@ function! fugitive#BufReadCmd(...) abort
|
|||||||
return 'silent doautocmd' . (v:version >= 704 ? ' <nomodeline>' : '') .
|
return 'silent doautocmd' . (v:version >= 704 ? ' <nomodeline>' : '') .
|
||||||
\ ' BufReadPost' . (modifiable ? '' : '|setl nomodifiable')
|
\ ' BufReadPost' . (modifiable ? '' : '|setl nomodifiable')
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
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
|
return mods . (a:count > 0 ? a:count : '') . 'split' . arg
|
||||||
endif
|
endif
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
@@ -2280,7 +2279,7 @@ function! s:Do(action, visual) abort
|
|||||||
endif
|
endif
|
||||||
let success = 1
|
let success = 1
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
finally
|
finally
|
||||||
if reload
|
if reload
|
||||||
execute s:ReloadStatus()
|
execute s:ReloadStatus()
|
||||||
@@ -2515,7 +2514,7 @@ function! s:StageDelete(lnum, count) abort
|
|||||||
try
|
try
|
||||||
call s:StageApply(info, 1, info.section ==# 'Staged' ? ['--index'] : [])
|
call s:StageApply(info, 1, info.section ==# 'Staged' ? ['--index'] : [])
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
elseif a:count == 2
|
elseif a:count == 2
|
||||||
call s:TreeChomp('checkout', '--ours', '--', info.paths[0])
|
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)'))
|
execute "Git reset --patch -- ".join(map(reset,'s:shellesc(v:val)'))
|
||||||
endif
|
endif
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
return s:ReloadStatus()
|
return s:ReloadStatus()
|
||||||
endfunction
|
endfunction
|
||||||
@@ -2742,7 +2741,7 @@ function! s:CommitCommand(line1, line2, range, count, bang, mods, reg, arg, args
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
finally
|
finally
|
||||||
if exists('old_editor')
|
if exists('old_editor')
|
||||||
let $GIT_EDITOR = 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, pre] = s:OpenParse(a:args)
|
||||||
let file = s:Generate(file)
|
let file = s:Generate(file)
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
if file !~# '^\a\a\+:'
|
if file !~# '^\a\a\+:'
|
||||||
let file = s:sub(file, '/$', '')
|
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, pre] = s:OpenParse(a:args)
|
||||||
let file = s:Generate(file)
|
let file = s:Generate(file)
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
if file =~# '^fugitive:' && after is# 0
|
if file =~# '^fugitive:' && after is# 0
|
||||||
return 'exe ' .string(mods . fugitive#FileReadCmd(file, 0, pre)) . '|diffupdate'
|
return 'exe ' .string(mods . fugitive#FileReadCmd(file, 0, pre)) . '|diffupdate'
|
||||||
@@ -3650,7 +3649,7 @@ function! s:Diff(vert,keepfocus,...) abort
|
|||||||
try
|
try
|
||||||
let file = fugitive#RevParse(arg).s:Relative(':')
|
let file = fugitive#RevParse(arg).s:Relative(':')
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
else
|
else
|
||||||
let file = s:Expand(arg)
|
let file = s:Expand(arg)
|
||||||
@@ -3685,7 +3684,7 @@ function! s:Diff(vert,keepfocus,...) abort
|
|||||||
endif
|
endif
|
||||||
return post
|
return post
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -3918,7 +3917,7 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args)
|
|||||||
endtry
|
endtry
|
||||||
return ''
|
return ''
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -4278,7 +4277,7 @@ function! s:BrowseCommand(line1, line2, range, count, bang, mods, reg, arg, args
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -4602,7 +4601,7 @@ function! s:GF(mode) abort
|
|||||||
try
|
try
|
||||||
let results = &filetype ==# 'fugitive' ? s:StatusCfile() : &filetype ==# 'gitcommit' ? [s:MessageCfile()] : s:cfile()
|
let results = &filetype ==# 'fugitive' ? s:StatusCfile() : &filetype ==# 'gitcommit' ? [s:MessageCfile()] : s:cfile()
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
if len(results) > 1
|
if len(results) > 1
|
||||||
return 'G' . a:mode .
|
return 'G' . a:mode .
|
||||||
|
|||||||
Reference in New Issue
Block a user