mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 06:13:51 -05:00
Handle symlinked directories more aggressively
This commit is contained in:
@@ -195,15 +195,18 @@ function! FugitiveTreeForGitDir(git_dir) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! FugitiveExtractGitDir(path) abort
|
function! FugitiveExtractGitDir(path) abort
|
||||||
if s:shellslash(a:path) =~# '^fugitive://.*//'
|
let path = s:shellslash(a:path)
|
||||||
return matchstr(s:shellslash(a:path), '\C^fugitive://\zs.\{-\}\ze//')
|
if path =~# '^fugitive://.*//'
|
||||||
endif
|
return matchstr(path, '\C^fugitive://\zs.\{-\}\ze//')
|
||||||
if isdirectory(a:path)
|
elseif isdirectory(path)
|
||||||
let path = fnamemodify(a:path, ':p:s?[\/]$??')
|
let path = fnamemodify(path, ':p:s?/$??')
|
||||||
else
|
else
|
||||||
let path = fnamemodify(a:path, ':p:h:s?[\/]$??')
|
let path = fnamemodify(path, ':p:h:s?/$??')
|
||||||
|
endif
|
||||||
|
let root = resolve(path)
|
||||||
|
if root !=# path
|
||||||
|
silent! exe haslocaldir() ? 'lcd .' : 'cd .'
|
||||||
endif
|
endif
|
||||||
let root = s:shellslash(resolve(path))
|
|
||||||
let previous = ""
|
let previous = ""
|
||||||
while root !=# previous
|
while root !=# previous
|
||||||
if root =~# '\v^//%([^/]+/?)?$'
|
if root =~# '\v^//%([^/]+/?)?$'
|
||||||
@@ -251,9 +254,6 @@ function! FugitiveDetect(path) abort
|
|||||||
let dir = FugitiveExtractGitDir(a:path)
|
let dir = FugitiveExtractGitDir(a:path)
|
||||||
if dir !=# ''
|
if dir !=# ''
|
||||||
let b:git_dir = dir
|
let b:git_dir = dir
|
||||||
if empty(fugitive#buffer().path())
|
|
||||||
silent! exe haslocaldir() ? 'lcd .' : 'cd .'
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if exists('b:git_dir')
|
if exists('b:git_dir')
|
||||||
|
|||||||
Reference in New Issue
Block a user