diff --git a/autoload/magit/git.vim b/autoload/magit/git.vim index 2d04bc4187b486ad4f3e581a4ab03bcd6c94c53e..f2428a9246acd8222144ad1ed6df0f9183762f08 100644 --- a/autoload/magit/git.vim +++ b/autoload/magit/git.vim @@ -171,8 +171,11 @@ function! magit#git#git_add(filename) let git_cmd=s:git_cmd . " add --no-ignore-removal -- " . a:filename silent let git_result=magit#utils#system(git_cmd) if ( v:shell_error != 0 ) - echoerr "Git error: " . git_result - echoerr "Git cmd: " . git_cmd + echohl WarningMsg + echom "Git error: " . git_result + echom "Git cmd: " . git_cmd + echohl None + throw 'add error' endif endfunction @@ -184,8 +187,11 @@ function! magit#git#git_checkout(filename) let git_cmd=s:git_cmd . " checkout -- " . a:filename silent let git_result=magit#utils#system(git_cmd) if ( v:shell_error != 0 ) - echoerr "Git error: " . git_result - echoerr "Git cmd: " . git_cmd + echohl WarningMsg + echom "Git error: " . git_result + echom "Git cmd: " . git_cmd + echohl None + throw 'checkout error' endif endfunction @@ -197,8 +203,11 @@ function! magit#git#git_reset(filename) let git_cmd=s:git_cmd . " reset HEAD -- " . a:filename silent let git_result=magit#utils#system(git_cmd) if ( v:shell_error != 0 ) - echoerr "Git error: " . git_result - echoerr "Git cmd: " . git_cmd + echohl WarningMsg + echom "Git error: " . git_result + echom "Git cmd: " . git_cmd + echohl None + throw 'reset error' endif endfunction @@ -216,10 +225,13 @@ function! magit#git#git_apply(header, selection) let git_cmd=s:git_cmd . " apply --recount --no-index --cached -" silent let git_result=magit#utils#system(git_cmd, selection) if ( v:shell_error != 0 ) - echoerr "Git error: " . git_result - echoerr "Git cmd: " . git_cmd - echoerr "Tried to aply this" - echoerr string(selection) + echohl WarningMsg + echom "Git error: " . git_result + echom "Git cmd: " . git_cmd + echom "Tried to aply this" + echom string(selection) + echohl None + throw 'apply error' endif endfunction @@ -242,9 +254,12 @@ function! magit#git#git_unapply(header, selection, mode) \ s:git_cmd . " apply --recount --no-index " . cached_flag . " --reverse - ", \ selection) if ( v:shell_error != 0 ) - echoerr "Git error: " . git_result - echoerr "Tried to unaply this" - echoerr string(selection) + echohl WarningMsg + echom "Git error: " . git_result + echom "Tried to unaply this" + echom string(selection) + echohl None + throw 'unapply error' endif endfunction