commit f395f3cbeaa353ff1545c3c8f86b2fef65003592 (tree)
parent 0765cbe4668dbdedb6f5b9cb83642ea3f43b41fe
Author: Tim Pope <code@tpope.net>
Date: Wed, 5 Mar 2014 17:57:43 -0500
Improve heuristics for status section detection
Closes #440.
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -739,14 +739,16 @@ function! s:stage_info(lnum) abort
endwhile
if !lnum
return ['', '']
- elseif getline(lnum+1) =~# '^# .*\<git \%(reset\|rm --cached\) ' || getline(lnum) ==# '# Changes to be committed:'
+ elseif (getline(lnum+1) =~# '^# .*\<git \%(reset\|rm --cached\) ' && getline(lnum+2) ==# '#') || getline(lnum) ==# '# Changes to be committed:'
return [matchstr(filename, colon.' *\zs.*'), 'staged']
+ elseif (getline(lnum+1) =~# '^# .*\<git add ' && getline(lnum+2) ==# '#') || getline(lnum) ==# '# Untracked files:'
+ return [filename, 'untracked']
elseif getline(lnum+2) =~# '^# .*\<git checkout ' || getline(lnum) ==# '# Changes not staged for commit:'
return [matchstr(filename, colon.' *\zs.*'), 'unstaged']
- elseif getline(lnum+1) =~# '^# .*\<git add/rm ' || getline(lnum) ==# '# Unmerged paths:'
+ elseif getline(lnum+2) =~# '^# .*\<git \%(add\|rm\)' || getline(lnum) ==# '# Unmerged paths:'
return [matchstr(filename, colon.' *\zs.*'), 'unmerged']
else
- return [filename, 'untracked']
+ return ['', 'unknown']
endif
endfunction