diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index c46c3c5..b85c155 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -247,9 +247,6 @@ function! airline#extensions#branch#head() endif endif - if has_key(heads, 'git') && !s:check_in_path() - let b:airline_head = '' - endif let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7 let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth) return b:airline_head @@ -264,35 +261,6 @@ function! airline#extensions#branch#get_head() \ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head) endfunction -function! s:check_in_path() - if !exists('b:airline_file_in_root') - let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', '')) - let bufferpath = resolve(fnamemodify(expand('%'), ':p')) - - if !filereadable(root) "not a file - " if .git is a directory, it's the old submodule format - if match(root, '\.git$') >= 0 - let root = expand(fnamemodify(root, ':h')) - else - " else it's the newer format, and we need to guesstimate - " 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 - endif - endif - - let b:airline_file_in_root = stridx(bufferpath, root) > -1 - endif - return b:airline_file_in_root -endfunction - function! s:reset_untracked_cache(shellcmdpost) " shellcmdpost - whether function was called as a result of ShellCmdPost hook if !g:airline#init#vim_async && !has('nvim') @@ -319,7 +287,6 @@ endfunction function! airline#extensions#branch#init(ext) call airline#parts#define_function('branch', 'airline#extensions#branch#get_head') - autocmd BufReadPost * unlet! b:airline_file_in_root autocmd ShellCmdPost,CmdwinLeave * unlet! b:airline_head b:airline_do_mq_check autocmd User AirlineBeforeRefresh unlet! b:airline_head b:airline_do_mq_check autocmd BufWritePost * call s:reset_untracked_cache(0)