Add :Git add --intent-to-add to :Gstatus P

This commit is contained in:
Tim Pope
2019-07-23 20:30:55 -04:00
parent ce283cbdbf
commit 55cb58cd5f
2 changed files with 14 additions and 7 deletions

View File

@@ -2970,6 +2970,7 @@ endfunction
function! s:StagePatch(lnum1,lnum2) abort
let add = []
let reset = []
let intend = []
for lnum in range(a:lnum1,a:lnum2)
let info = s:StageInfo(lnum)
@@ -2985,11 +2986,16 @@ function! s:StagePatch(lnum1,lnum2) abort
execute lnum
if info.section ==# 'Staged'
let reset += info.relative
elseif info.section ==# 'Untracked'
let intend += info.paths
elseif info.status !~# '^D'
let add += info.relative
endif
endfor
try
if !empty(intend)
call s:TreeChomp(['add', '--intent-to-add', '--'] + intend)
endif
if !empty(add)
execute "Git add --patch -- ".join(map(add,'s:fnameescape(v:val)'))
endif