Make argument to FugitiveTreeForGitDir optional

This commit is contained in:
Tim Pope 2018-07-21 15:43:05 -04:00
parent c118dabb89
commit 35f94eef48

View File

@ -25,8 +25,8 @@ endfunction
let s:worktree_for_dir = {}
let s:dir_for_worktree = {}
function! FugitiveTreeForGitDir(git_dir) abort
let dir = substitute(s:shellslash(a:git_dir), '/$', '', '')
function! FugitiveTreeForGitDir(...) abort
let dir = substitute(s:shellslash(a:0 ? a:1 : get(b:, 'git_dir', '')), '/$', '', '')
if dir =~# '/\.git$'
return len(dir) ==# 5 ? '/' : dir[0:-6]
endif