Avoid unnecessary diffing in :Gstatus

This commit is contained in:
Tim Pope 2019-07-28 21:45:55 -04:00
parent fff24e29e6
commit 3c4ad5ff72

View File

@ -1753,9 +1753,16 @@ function! fugitive#BufReadStatus() abort
endfor
endif
let b:fugitive_diff = {
\ 'Staged': s:LinesError(['diff', '--color=never', '--no-ext-diff', '--no-prefix', '--cached'])[0],
\ 'Unstaged': s:LinesError(['diff', '--color=never', '--no-ext-diff', '--no-prefix'])[0]}
let diff = {'Staged': [], 'Unstaged': []}
if len(staged)
let diff['Staged'] =
\ s:LinesError(['diff', '--color=never', '--no-ext-diff', '--no-prefix', '--cached'])[0]
endif
if len(unstaged)
let diff['Unstaged'] =
\ s:LinesError(['diff', '--color=never', '--no-ext-diff', '--no-prefix'])[0]
endif
let b:fugitive_diff = diff
let expanded = get(b:, 'fugitive_expanded', {'Staged': {}, 'Unstaged': {}})
let b:fugitive_expanded = {'Staged': {}, 'Unstaged': {}}