mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-07 21:24:40 +08:00
@@ -715,6 +715,9 @@ endfunction
|
|||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
|
|
||||||
function! s:get_git_root(dir)
|
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 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]
|
let root = systemlist('git -C ' . shellescape(dir) . ' rev-parse --show-toplevel')[0]
|
||||||
return v:shell_error ? '' : (len(a:dir) ? fnamemodify(a:dir, ':p') : root)
|
return v:shell_error ? '' : (len(a:dir) ? fnamemodify(a:dir, ':p') : root)
|
||||||
|
|||||||
Reference in New Issue
Block a user