From 0356edf6b8a82d6654e94d1669c9d9dd6c5507ab Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 26 Oct 2019 09:05:49 -0400 Subject: [PATCH] Optimize away log calls in :Gstatus if no upstream changes --- autoload/fugitive.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 2927401..d0324e7 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1620,6 +1620,7 @@ function! fugitive#BufReadStatus() abort let b:fugitive_files = {'Staged': {}, 'Unstaged': {}} let [staged, unstaged, untracked] = [[], [], []] + let props = {} if fugitive#GitVersion(2, 11) let cmd += ['status', '--porcelain=v2', '-bz'] @@ -1628,7 +1629,6 @@ function! fugitive#BufReadStatus() abort throw 'fugitive: ' . message endif - let props = {} let i = 0 while i < len(output) let line = output[i] @@ -1740,12 +1740,12 @@ function! fugitive#BufReadStatus() abort let push = pull endif - if len(pull) + if len(pull) && get(props, 'branch.ab') !~# ' -0$' let unpulled = s:QueryLog(head . '..' . pull) else let unpulled = [] endif - if len(push) + if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ') let unpushed = s:QueryLog(push . '..' . head) else let unpushed = []