mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-11 04:53:45 -05:00
BufReadObject: handle rev-parse errors
With `:Gdiff ^` on a file that has just been added, you would get an
error via `git rev-parse --verify`:
> fatal: Needed a single revision
The error message is clearer when not using `--verify`:
> fatal: Path 'X' exists on disk, but not in 'SHA'.
The behavior depends on if you use `:set hidden`, where the second
invocation works, as in will open an empty buffer - apparently since it
has been created as "a buffer with read errors" ("x" in `:ls!`) before.
Fixes https://github.com/tpope/vim-fugitive/issues/866.
This commit is contained in:
@@ -2749,6 +2749,8 @@ function! s:BufReadObject() abort
|
|||||||
endif
|
endif
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
|
return ''
|
||||||
|
catch /^fugitive: rev-parse/
|
||||||
return ''
|
return ''
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr v:errmsg'
|
||||||
|
|||||||
Reference in New Issue
Block a user