From 0022de3b7863c0d9d4235167f37753015e02919f Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 5 Feb 2016 23:07:47 +0100 Subject: [PATCH] Small improvement for untracked feature first argument of git status is in git speech, and so if you feed it a directory, that contained an untracked file, the directory would be marked as untracked. So fix this. --- autoload/airline/extensions/branch.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index 7ae7d4df..d7f227d7 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -73,8 +73,10 @@ function! s:get_git_untracked(file) if has_key(s:untracked_git, a:file) let untracked = s:untracked_git[a:file] else - let untracked = ((system('git status --porcelain -- ' . a:file)[0:1]) is# '??' ? - \ get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) : '') + let output = system('git status --porcelain -- '. a:file) + if output[0:1] is# '??' && output[3:-2] is? a:file + let untracked = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) + endif let s:untracked_git[a:file] = untracked endif return untracked