motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 3c4ad5ff72860aee9dbb04fc67aa904568a5a32d (tree)
parent fff24e29e6e215ec1b034a7c33371ded167e01e8
Author: Tim Pope <code@tpope.net>
Date:   Sun, 28 Jul 2019 21:45:55 -0400

Avoid unnecessary diffing in :Gstatus

Diffstat:
Mautoload/fugitive.vim | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -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': {}}