Partially support ".git" files and symlinks without core.worktree

This is not and can never be 100% perfect.  There's no way to work back
from a file like info/exclude COMMIT_EDITMSG to the work tree.  So
core.worktree continues to be recommended.

References: https://github.com/tpope/vim-fugitive/issues/1920
This commit is contained in:
Tim Pope
2022-06-03 18:39:44 -04:00
parent d72fbcb0a4
commit 0996bae836
2 changed files with 39 additions and 19 deletions

View File

@@ -1796,7 +1796,9 @@ function! fugitive#Find(object, ...) abort
elseif rev ==# ':'
let fdir = simplify(FugitiveActualDir(dir) . '/')
let f = fdir . 'index'
if len($GIT_INDEX_FILE)
if !s:cpath(dir . '/', fdir)
let f = urlprefix
elseif len($GIT_INDEX_FILE)
let index_dir = substitute(s:GitIndexFileEnv(), '[^/]\+$', '', '')
if s:cpath(index_dir, fdir)
let f = s:GitIndexFileEnv()