From b540332a3e83024cc447c329e311837e568799ed Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 6 Oct 2021 17:35:22 -0400 Subject: [PATCH] Improve parallelism of status buffer with earlier diff This is a trivial gain, but also trivial to implement. --- autoload/fugitive.vim | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 8a86362..a71a4a1 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -2669,6 +2669,16 @@ function! fugitive#BufReadStatus() abort endwhile endif + let diff = {'Staged': {'stdout': ['']}, 'Unstaged': {'stdout': ['']}} + if len(staged) + let diff['Staged'] = + \ fugitive#Execute(['diff', '--color=never', '--no-ext-diff', '--no-prefix', '--cached'], function('len')) + endif + if len(unstaged) + let diff['Unstaged'] = + \ fugitive#Execute(['diff', '--color=never', '--no-ext-diff', '--no-prefix'], function('len')) + endif + for dict in staged let b:fugitive_files['Staged'][dict.filename] = dict endfor @@ -2745,15 +2755,6 @@ function! fugitive#BufReadStatus() abort endfor endif - let diff = {'Staged': {'stdout': ['']}, 'Unstaged': {'stdout': ['']}} - if len(staged) - let diff['Staged'] = - \ fugitive#Execute(['diff', '--color=never', '--no-ext-diff', '--no-prefix', '--cached'], function('len')) - endif - if len(unstaged) - let diff['Unstaged'] = - \ fugitive#Execute(['diff', '--color=never', '--no-ext-diff', '--no-prefix'], function('len')) - endif let b:fugitive_diff = diff if v:cmdbang unlet! b:fugitive_expanded