diff --git a/autoload/magit/git.vim b/autoload/magit/git.vim index a2ed3daa68d8c81b9340bc8d64a902409be12fb0..8e0142c6bda4fabd1e9db48d822e0d38d9715c1f 100644 --- a/autoload/magit/git.vim +++ b/autoload/magit/git.vim @@ -51,13 +51,11 @@ function! magit#git#is_work_tree(path) let dir = getcwd() try call magit#utils#chdir(a:path) - try - let top_dir=magit#utils#strip( - \ system(g:magit_git_cmd . " rev-parse --show-toplevel")) . "/" - catch 'shell_error' + let top_dir=system(g:magit_git_cmd . " rev-parse --show-toplevel") + if ( v:shell_error != 0 ) return '' - endtry - return top_dir + endif + return magit#utils#strip(top_dir) . "/" finally call magit#utils#chdir(dir) endtry diff --git a/plugin/magit.vim b/plugin/magit.vim index 03e5d5d8042cdd4cb878387bcfb882afa6cba02e..53c44c6018424bc907cdb691b12c07090d05b04f 100644 --- a/plugin/magit.vim +++ b/plugin/magit.vim @@ -732,13 +732,13 @@ function! magit#show_magit(display, ...) if ( git_dir == '' ) echohl ErrorMsg echom "magit can not find any git repository" + echohl None echom "make sure that current opened file or vim current directory points to a git repository" echom "search paths:" for path in try_paths echom path endfor - echohl None - throw 'magit_not_in_git_repo' + return endif let buffer_name=fnameescape('magit://' . git_dir)