mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-12-07 04:34:35 +08:00
Make status buffer diff retrieval asynchronous
Resolves: https://github.com/tpope/vim-fugitive/issues/1856
This commit is contained in:
@@ -2742,14 +2742,14 @@ function! fugitive#BufReadStatus() abort
|
|||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let diff = {'Staged': [], 'Unstaged': []}
|
let diff = {'Staged': {'stdout': ['']}, 'Unstaged': {'stdout': ['']}}
|
||||||
if len(staged)
|
if len(staged)
|
||||||
let diff['Staged'] =
|
let diff['Staged'] =
|
||||||
\ s:LinesError(['diff', '--color=never', '--no-ext-diff', '--no-prefix', '--cached'])[0]
|
\ fugitive#Execute(['diff', '--color=never', '--no-ext-diff', '--no-prefix', '--cached'], function('len'))
|
||||||
endif
|
endif
|
||||||
if len(unstaged)
|
if len(unstaged)
|
||||||
let diff['Unstaged'] =
|
let diff['Unstaged'] =
|
||||||
\ s:LinesError(['diff', '--color=never', '--no-ext-diff', '--no-prefix'])[0]
|
\ fugitive#Execute(['diff', '--color=never', '--no-ext-diff', '--no-prefix'], function('len'))
|
||||||
endif
|
endif
|
||||||
let b:fugitive_diff = diff
|
let b:fugitive_diff = diff
|
||||||
if v:cmdbang
|
if v:cmdbang
|
||||||
@@ -4671,7 +4671,7 @@ function! s:StageInline(mode, ...) abort
|
|||||||
let diff = []
|
let diff = []
|
||||||
let index = 0
|
let index = 0
|
||||||
let start = -1
|
let start = -1
|
||||||
for line in b:fugitive_diff[info.section]
|
for line in fugitive#Wait(b:fugitive_diff[info.section]).stdout
|
||||||
if mode ==# 'await' && line[0] ==# '@'
|
if mode ==# 'await' && line[0] ==# '@'
|
||||||
let mode = 'capture'
|
let mode = 'capture'
|
||||||
endif
|
endif
|
||||||
@@ -4795,10 +4795,11 @@ function! s:StageApply(info, reverse, extra) abort
|
|||||||
endif
|
endif
|
||||||
let i = b:fugitive_expanded[info.section][info.filename][0]
|
let i = b:fugitive_expanded[info.section][info.filename][0]
|
||||||
let head = []
|
let head = []
|
||||||
while get(b:fugitive_diff[info.section], i, '@') !~# '^@'
|
let diff_lines = fugitive#Wait(b:fugitive_diff[info.section]).stdout
|
||||||
let line = b:fugitive_diff[info.section][i]
|
while get(diff_lines, i, '@') !~# '^@'
|
||||||
|
let line = diff_lines[i]
|
||||||
if line ==# '--- /dev/null'
|
if line ==# '--- /dev/null'
|
||||||
call add(head, '--- ' . get(b:fugitive_diff[info.section], i + 1, '')[4:-1])
|
call add(head, '--- ' . get(diff_lines, i + 1, '')[4:-1])
|
||||||
elseif line !~# '^new file '
|
elseif line !~# '^new file '
|
||||||
call add(head, line)
|
call add(head, line)
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user