commit 5eeb7625df75a0da931d81a84e8730aca8b8c8a1 (tree)
parent 4f0905e963c22e633138203a7f4bb927bb9f1404
Author: Tim Pope <code@tpope.net>
Date: Tue, 1 Oct 2019 16:19:36 -0400
Expand status file lookup into nested structure
References https://github.com/tpope/vim-fugitive/pull/1337
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -1668,7 +1668,7 @@ function! fugitive#BufReadStatus() abort
let branch = head
endif
- let b:fugitive_status = {'Staged': {}, 'Unstaged': {}}
+ let b:fugitive_files = {'Staged': {}, 'Unstaged': {}}
let [staged, unstaged, untracked] = [[], [], []]
let i = 0
while i < len(output)
@@ -1694,10 +1694,10 @@ function! fugitive#BufReadStatus() abort
endwhile
for dict in staged
- let b:fugitive_status['Staged'][dict.filename] = dict.status
+ let b:fugitive_files['Staged'][dict.filename] = dict
endfor
for dict in unstaged
- let b:fugitive_status['Unstaged'][dict.filename] = dict.status
+ let b:fugitive_files['Unstaged'][dict.filename] = dict
endfor
let config = fugitive#Config()
@@ -3076,7 +3076,7 @@ function! s:StageDelete(lnum1, lnum2, count) abort
elseif a:count == 3
call s:TreeChomp('checkout', '--theirs', '--', info.paths[0])
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])
elseif info.status ==# 'U'
call s:TreeChomp('rm', '--', info.paths[0])