From 4e77ba13c651dd2ebe705756b6d85fb4b1787fbc Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 10 Nov 2009 22:26:08 -0500 Subject: [PATCH] Fix :Glog when run from a file in .git/ --- plugin/fugitive.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 0700c19..4e14f9a 100644 --- 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