mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-06 20:54:28 +08:00
@@ -715,6 +715,9 @@ endfunction
|
||||
" ------------------------------------------------------------------
|
||||
|
||||
function! s:get_git_root(dir)
|
||||
if empty(a:dir) && exists('*FugitiveWorkTree')
|
||||
return FugitiveWorkTree()
|
||||
endif
|
||||
let dir = len(a:dir) ? a:dir : substitute(split(expand('%:p:h'), '[/\\]\.git\([/\\]\|$\)')[0], '^fugitive://', '', '')
|
||||
let root = systemlist('git -C ' . shellescape(dir) . ' rev-parse --show-toplevel')[0]
|
||||
return v:shell_error ? '' : (len(a:dir) ? fnamemodify(a:dir, ':p') : root)
|
||||
|
||||
Reference in New Issue
Block a user