Provide explanatory error on :Gdiff ~

References https://github.com/tpope/vim-fugitive/issues/1402
This commit is contained in:
Tim Pope
2019-11-19 15:05:11 -05:00
parent 13fdeb5fa7
commit dc5320630d

View File

@@ -4633,6 +4633,8 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort
elseif arg =~# '^:\d$'
exe s:DirCheck()
let file = s:Relative(arg . ':')
elseif arg =~# '^[~^]\d*$'
return 'echoerr ' . string('fugitive: change ' . arg . ' to !' . arg . ' to diff against ancestor')
else
try
let file = arg =~# '^:/.' ? fugitive#RevParse(arg) . s:Relative(':') : s:Expand(arg)