mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-08 05:24:47 +08:00
Fix git root detection (#239)
This commit is contained in:
@@ -408,13 +408,14 @@ function! s:get_git_root()
|
|||||||
try
|
try
|
||||||
return fugitive#repo().tree()
|
return fugitive#repo().tree()
|
||||||
catch
|
catch
|
||||||
return split(system('git rev-parse --show-toplevel'), '\n')[0]
|
let root = split(system('git rev-parse --show-toplevel'), '\n')[0]
|
||||||
|
return v:shell_error ? '' : root
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! fzf#vim#gitfiles(args, ...)
|
function! fzf#vim#gitfiles(args, ...)
|
||||||
let root = s:get_git_root()
|
let root = s:get_git_root()
|
||||||
if v:shell_error
|
if empty(root)
|
||||||
return s:warn('Not in git repo')
|
return s:warn('Not in git repo')
|
||||||
endif
|
endif
|
||||||
if a:args != '?'
|
if a:args != '?'
|
||||||
@@ -948,7 +949,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:commits(buffer_local, args)
|
function! s:commits(buffer_local, args)
|
||||||
let s:git_root = s:get_git_root()
|
let s:git_root = s:get_git_root()
|
||||||
if v:shell_error
|
if empty(s:git_root)
|
||||||
return s:warn('Not in git repository')
|
return s:warn('Not in git repository')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user