Fix :Glog when run from a file in .git/

This commit is contained in:
Tim Pope 2009-11-10 22:26:08 -05:00
parent 9761434605
commit 4e77ba13c6

View File

@ -572,13 +572,17 @@ function! s:Grep(bang,arg) abort
endfunction endfunction
function! s:Log(cmd) function! s:Log(cmd)
let cmd = ['--no-pager', 'log', '--no-color', '--pretty=format:fugitive://'.s:repo().dir().'//%H'.s:buffer().path('/').'::%s'] let path = s:buffer().path('/')
if path =~# '^/\.git\%(/\|$\)'
let path = ''
endif
let cmd = ['--no-pager', 'log', '--no-color', '--pretty=format:fugitive://'.s:repo().dir().'//%H'.path.'::%s']
if s:buffer().commit() =~# '\x\{40\}' if s:buffer().commit() =~# '\x\{40\}'
let cmd += [s:buffer().commit().'^'] let cmd += [s:buffer().commit().'^']
endif endif
let cmd += ['--'] let cmd += ['--']
if s:buffer().path() != '' if path =~# '/.'
let cmd += [s:buffer().path()] let cmd += [path[1 : -1]]
endif endif
let grepformat = &grepformat let grepformat = &grepformat
let grepprg = &grepprg let grepprg = &grepprg