Optimize away log calls in :Gstatus if no upstream changes

This commit is contained in:
Tim Pope
2019-10-26 09:05:49 -04:00
parent e8c5b604db
commit 0356edf6b8

View File

@@ -1620,6 +1620,7 @@ function! fugitive#BufReadStatus() abort
let b:fugitive_files = {'Staged': {}, 'Unstaged': {}} let b:fugitive_files = {'Staged': {}, 'Unstaged': {}}
let [staged, unstaged, untracked] = [[], [], []] let [staged, unstaged, untracked] = [[], [], []]
let props = {}
if fugitive#GitVersion(2, 11) if fugitive#GitVersion(2, 11)
let cmd += ['status', '--porcelain=v2', '-bz'] let cmd += ['status', '--porcelain=v2', '-bz']
@@ -1628,7 +1629,6 @@ function! fugitive#BufReadStatus() abort
throw 'fugitive: ' . message throw 'fugitive: ' . message
endif endif
let props = {}
let i = 0 let i = 0
while i < len(output) while i < len(output)
let line = output[i] let line = output[i]
@@ -1740,12 +1740,12 @@ function! fugitive#BufReadStatus() abort
let push = pull let push = pull
endif endif
if len(pull) if len(pull) && get(props, 'branch.ab') !~# ' -0$'
let unpulled = s:QueryLog(head . '..' . pull) let unpulled = s:QueryLog(head . '..' . pull)
else else
let unpulled = [] let unpulled = []
endif endif
if len(push) if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ')
let unpushed = s:QueryLog(push . '..' . head) let unpushed = s:QueryLog(push . '..' . head)
else else
let unpushed = [] let unpushed = []