mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 22:03:51 -05:00
Support partial staging after git add -N
Closes https://github.com/tpope/vim-fugitive/issues/1567
This commit is contained in:
@@ -3521,7 +3521,12 @@ function! s:StageApply(info, reverse, extra) abort
|
|||||||
let i = b:fugitive_expanded[info.section][info.filename][0]
|
let i = b:fugitive_expanded[info.section][info.filename][0]
|
||||||
let head = []
|
let head = []
|
||||||
while get(b:fugitive_diff[info.section], i, '@') !~# '^@'
|
while get(b:fugitive_diff[info.section], i, '@') !~# '^@'
|
||||||
call add(head, b:fugitive_diff[info.section][i])
|
let line = b:fugitive_diff[info.section][i]
|
||||||
|
if line ==# '--- /dev/null'
|
||||||
|
call add(head, '--- ' . get(b:fugitive_diff[info.section], i + 1, '')[4:-1])
|
||||||
|
elseif line !~# '^new file '
|
||||||
|
call add(head, line)
|
||||||
|
endif
|
||||||
let i += 1
|
let i += 1
|
||||||
endwhile
|
endwhile
|
||||||
call extend(lines, head, 'keep')
|
call extend(lines, head, 'keep')
|
||||||
@@ -3731,7 +3736,7 @@ function! s:DoUnstageStaged(record) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:DoToggleUnstaged(record) abort
|
function! s:DoToggleUnstaged(record) abort
|
||||||
if a:record.patch && a:record.status !=# 'A'
|
if a:record.patch
|
||||||
return s:StageApply(a:record, 0, ['--cached'])
|
return s:StageApply(a:record, 0, ['--cached'])
|
||||||
else
|
else
|
||||||
call s:TreeChomp(['add', '-A', '--'] + a:record.paths)
|
call s:TreeChomp(['add', '-A', '--'] + a:record.paths)
|
||||||
|
|||||||
Reference in New Issue
Block a user