mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-02-01 02:06:15 +08:00
Make airline aware of git worktrees
Currently vim-airline assumes, that the git_dir is part of the path for the file being edited. This has changed, since git supports worktrees. So take care of b:git_dir (which is set by fugitive) being a path differently from the absolute path of the file being edited (however, it should include the substring worktree in that case).
This commit is contained in:
parent
3ebd7ad64b
commit
d4a239f14a
|
@ -351,7 +351,13 @@ function! s:check_in_path()
|
|||
let root = expand(fnamemodify(root, ':h'))
|
||||
else
|
||||
" else it's the newer format, and we need to guesstimate
|
||||
let pattern = '\.git\(\\\|\/\)modules\(\\\|\/\)'
|
||||
" 1) check for worktrees
|
||||
if match(root, 'worktrees') > -1
|
||||
" worktree can be anywhere, so simply assume true here
|
||||
return 1
|
||||
endif
|
||||
" 2) check for submodules
|
||||
let pattern = '\.git[\\/]\(modules\)[\\/]'
|
||||
if match(root, pattern) >= 0
|
||||
let root = substitute(root, pattern, '', '')
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user