mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-11 12:53:52 -05:00
Expand status file lookup into nested structure
References https://github.com/tpope/vim-fugitive/pull/1337
This commit is contained in:
@@ -1668,7 +1668,7 @@ function! fugitive#BufReadStatus() abort
|
|||||||
let branch = head
|
let branch = head
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let b:fugitive_status = {'Staged': {}, 'Unstaged': {}}
|
let b:fugitive_files = {'Staged': {}, 'Unstaged': {}}
|
||||||
let [staged, unstaged, untracked] = [[], [], []]
|
let [staged, unstaged, untracked] = [[], [], []]
|
||||||
let i = 0
|
let i = 0
|
||||||
while i < len(output)
|
while i < len(output)
|
||||||
@@ -1694,10 +1694,10 @@ function! fugitive#BufReadStatus() abort
|
|||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
for dict in staged
|
for dict in staged
|
||||||
let b:fugitive_status['Staged'][dict.filename] = dict.status
|
let b:fugitive_files['Staged'][dict.filename] = dict
|
||||||
endfor
|
endfor
|
||||||
for dict in unstaged
|
for dict in unstaged
|
||||||
let b:fugitive_status['Unstaged'][dict.filename] = dict.status
|
let b:fugitive_files['Unstaged'][dict.filename] = dict
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
let config = fugitive#Config()
|
let config = fugitive#Config()
|
||||||
@@ -3076,7 +3076,7 @@ function! s:StageDelete(lnum1, lnum2, count) abort
|
|||||||
elseif a:count == 3
|
elseif a:count == 3
|
||||||
call s:TreeChomp('checkout', '--theirs', '--', info.paths[0])
|
call s:TreeChomp('checkout', '--theirs', '--', info.paths[0])
|
||||||
elseif info.status =~# '[ADU]' &&
|
elseif info.status =~# '[ADU]' &&
|
||||||
\ get(b:fugitive_status[info.section ==# 'Staged' ? 'Unstaged' : 'Staged'], info.filename, '') =~# '[AU]'
|
\ get(b:fugitive_files[info.section ==# 'Staged' ? 'Unstaged' : 'Staged'], info.filename, {'status': ''}).status =~# '[AU]'
|
||||||
call s:TreeChomp('checkout', info.section ==# 'Staged' ? '--ours' : '--theirs', '--', info.paths[0])
|
call s:TreeChomp('checkout', info.section ==# 'Staged' ? '--ours' : '--theirs', '--', info.paths[0])
|
||||||
elseif info.status ==# 'U'
|
elseif info.status ==# 'U'
|
||||||
call s:TreeChomp('rm', '--', info.paths[0])
|
call s:TreeChomp('rm', '--', info.paths[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user