From 2735282992f360ce0f4e0255f420e4977a24282f Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Tue, 1 Oct 2013 21:36:24 -0400 Subject: [PATCH] account for different git submodule format. resolves #273. --- autoload/airline/extensions/branch.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index 52e72a6..9705d7e 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -40,7 +40,11 @@ function! s:check_in_path() if !exists('b:airline_branch_path') let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', '')) let bufferpath = resolve(fnamemodify(expand('%'), ':p:h')) - let root = expand(fnamemodify(root, ':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')) + endif let b:airline_file_in_root = stridx(bufferpath, root) > -1 endif return b:airline_file_in_root