account for different git submodule format. resolves #273.

This commit is contained in:
Bailey Ling 2013-10-01 21:36:24 -04:00
parent 0f23d9373c
commit 2735282992

View File

@ -40,7 +40,11 @@ function! s:check_in_path()
if !exists('b:airline_branch_path') if !exists('b:airline_branch_path')
let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', '')) let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', ''))
let bufferpath = resolve(fnamemodify(expand('%'), ':p:h')) let bufferpath = resolve(fnamemodify(expand('%'), ':p:h'))
" .git may be a repo or a file depending on the version of git for submodules
if !filereadable(root)
let root = expand(fnamemodify(root, ':h')) let root = expand(fnamemodify(root, ':h'))
endif
let b:airline_file_in_root = stridx(bufferpath, root) > -1 let b:airline_file_in_root = stridx(bufferpath, root) > -1
endif endif
return b:airline_file_in_root return b:airline_file_in_root