Remove "." from 'path' in "fugitive://" files

Having "." in 'path' causes commands like :find to dump one in
never-never land when invoked from a "fugitive://" file.
This commit is contained in:
Tim Pope 2009-12-13 19:49:35 -05:00
parent 037ce62894
commit 063d1fcaa9

View File

@ -101,6 +101,10 @@ function! s:Detect()
if exists('b:git_dir') if exists('b:git_dir')
silent doautocmd User Fugitive silent doautocmd User Fugitive
cnoremap <expr> <buffer> <C-R><C-G> fugitive#buffer().rev() cnoremap <expr> <buffer> <C-R><C-G> fugitive#buffer().rev()
if expand('%:p') =~# '//'
let buffer = fugitive#buffer()
call buffer.setvar('&path',s:sub(buffer.getvar('&path'),'^\.%(,|$)',''))
endif
endif endif
endfunction endfunction
@ -295,6 +299,10 @@ function! s:buffer_getvar(var) dict abort
return getbufvar(self['#'],a:var) return getbufvar(self['#'],a:var)
endfunction endfunction
function! s:buffer_setvar(var,value) dict abort
return setbufvar(self['#'],a:var,a:value)
endfunction
function! s:buffer_getline(lnum) dict abort function! s:buffer_getline(lnum) dict abort
return getbufline(self['#'],a:lnum)[0] return getbufline(self['#'],a:lnum)[0]
endfunction endfunction
@ -395,7 +403,7 @@ function! s:buffer_containing_commit() dict abort
endif endif
endfunction endfunction
call s:add_methods('buffer',['getvar','getline','repo','type','name','commit','path','rev','sha1','expand','containing_commit']) call s:add_methods('buffer',['getvar','setvar','getline','repo','type','name','commit','path','rev','sha1','expand','containing_commit'])
" }}}1 " }}}1
" Git {{{1 " Git {{{1