commit 4e77ba13c651dd2ebe705756b6d85fb4b1787fbc (tree)
parent 9761434605392507dc2cb32a41386556d7a4e274
Author: Tim Pope <code@tpope.net>
Date: Tue, 10 Nov 2009 22:26:08 -0500
Fix :Glog when run from a file in .git/
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -572,13 +572,17 @@ function! s:Grep(bang,arg) abort
endfunction
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\}'
let cmd += [s:buffer().commit().'^']
endif
let cmd += ['--']
- if s:buffer().path() != ''
- let cmd += [s:buffer().path()]
+ if path =~# '/.'
+ let cmd += [path[1 : -1]]
endif
let grepformat = &grepformat
let grepprg = &grepprg