Fix :[range]Glog

Closes https://github.com/tpope/vim-fugitive/issues/1280
This commit is contained in:
Tim Pope 2019-07-09 13:14:23 -04:00
parent ad2e408e15
commit 23138572f4

View File

@ -3421,16 +3421,16 @@ function! s:Log(type, bang, line1, line2, args) abort
else else
let paths = [] let paths = []
endif endif
let path = fugitive#Path(@%, '', dir) let path = fugitive#Path(@%, '/', dir)
if path =~# '^\.git\%(/\|$\)' || a:line2 < 0 if path =~# '^/\.git\%(/\|$\)\|^$' || a:line2 < 0
let path = '' let path = ''
elseif a:line2 > 0 elseif a:line2 > 0
call add(args, '-L' . a:line1 . ',' . a:line2 . ':' . path) call add(args, '-L' . a:line1 . ',' . a:line2 . ':' . path[1:-1])
else else
if empty(paths) if empty(paths)
call add(paths, '--') call add(paths, '--')
endif endif
call add(paths, path) call add(paths, path ==# '/' ? '.' : path[1:-1])
endif endif
if len(path) && empty(filter(copy(args), 'v:val =~# "^[^-]"')) if len(path) && empty(filter(copy(args), 'v:val =~# "^[^-]"'))
let owner = s:Owner(@%, dir) let owner = s:Owner(@%, dir)