Cope with new "Changes not staged" heading

This commit is contained in:
Tim Pope 2011-04-23 21:23:52 -04:00
parent 68b3f3b3d6
commit a71120ca8f

View File

@ -640,9 +640,9 @@ function! s:StagePatch(lnum1,lnum2) abort
for lnum in range(a:lnum1,a:lnum2) for lnum in range(a:lnum1,a:lnum2)
let line = getline(lnum) let line = getline(lnum)
if line == '# Changes to be committed:' if line ==# '# Changes to be committed:'
return 'Git reset --patch' return 'Git reset --patch'
elseif line == '# Changed but not updated:' elseif line =~# '^# Change\%(d but not updated\|s not staged for commit\):$'
return 'Git add --patch' return 'Git add --patch'
endif endif
let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( (new commits)\)\=$') let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( (new commits)\)\=$')