mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-08 11:33:47 -05:00
Compare commits
1 Commits
036918c3ec
...
parallel-s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
195edd146f |
@@ -2183,11 +2183,22 @@ function! s:ReplaceCmd(cmd) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:QueryLog(refspec) abort
|
function! s:StatusLogCallback(result, dest) abort
|
||||||
let lines = s:LinesError(['log', '-n', '256', '--pretty=format:%h%x09%s', a:refspec, '--'])[0]
|
let lines = a:result.stdout
|
||||||
|
if empty(lines[-1])
|
||||||
|
call remove(lines, -1)
|
||||||
|
endif
|
||||||
call map(lines, 'split(v:val, "\t", 1)')
|
call map(lines, 'split(v:val, "\t", 1)')
|
||||||
call map(lines, '{"type": "Log", "commit": v:val[0], "subject": join(v:val[1 : -1], "\t")}')
|
call map(lines, '{"type": "Log", "commit": v:val[0], "subject": join(v:val[1 : -1], "\t")}')
|
||||||
return lines
|
call add(a:dest, lines)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:StatusLog(refspec, dest) abort
|
||||||
|
return fugitive#Execute(['log', '-n', '256', '--pretty=format:%h%x09%s', a:refspec, '--'], function('s:StatusLogCallback'), a:dest)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:StatusDiffCallback(result, dict, key) abort
|
||||||
|
let a:dict[a:key] = a:result.stdout
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:FormatLog(dict) abort
|
function! s:FormatLog(dict) abort
|
||||||
@@ -2377,6 +2388,15 @@ function! fugitive#BufReadStatus() abort
|
|||||||
let b:fugitive_files['Unstaged'][dict.filename] = dict
|
let b:fugitive_files['Unstaged'][dict.filename] = dict
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
let jobs = []
|
||||||
|
let diff = {'Staged': [], 'Unstaged': []}
|
||||||
|
if len(staged)
|
||||||
|
call add(jobs, fugitive#Execute(['diff', '--color=never', '--no-ext-diff', '--no-prefix', '--cached'], function('s:StatusDiffCallback'), diff, 'Staged'))
|
||||||
|
endif
|
||||||
|
if len(unstaged)
|
||||||
|
call add(jobs, fugitive#Execute(['diff', '--color=never', '--no-ext-diff', '--no-prefix'], function('s:StatusDiffCallback'), diff, 'Unstaged'))
|
||||||
|
endif
|
||||||
|
|
||||||
let pull_type = 'Pull'
|
let pull_type = 'Pull'
|
||||||
if len(pull)
|
if len(pull)
|
||||||
let rebase = FugitiveConfigGet('branch.' . branch . '.rebase', config)
|
let rebase = FugitiveConfigGet('branch.' . branch . '.rebase', config)
|
||||||
@@ -2412,6 +2432,24 @@ function! fugitive#BufReadStatus() abort
|
|||||||
let push = len(branch) ? (push_remote ==# '.' ? '' : push_remote . '/') . branch : ''
|
let push = len(branch) ? (push_remote ==# '.' ? '' : push_remote . '/') . branch : ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let logs = []
|
||||||
|
if len(pull) && get(props, 'branch.ab') !~# ' -0$'
|
||||||
|
call add(logs, ['Unpulled from ' . pull])
|
||||||
|
call add(jobs, s:StatusLog(head . '..' . pull, logs[-1]))
|
||||||
|
endif
|
||||||
|
if len(push) && push !=# pull
|
||||||
|
call add(logs, ['Unpulled from ' . push])
|
||||||
|
call add(jobs, s:StatusLog(head . '..' . push, logs[-1]))
|
||||||
|
endif
|
||||||
|
if len(pull) && push !=# pull
|
||||||
|
call add(logs, ['Unpushed to ' . pull])
|
||||||
|
call add(jobs, s:StatusLog(pull . '..' . head, logs[-1]))
|
||||||
|
endif
|
||||||
|
if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ')
|
||||||
|
call add(logs, ['Unpushed to ' . push])
|
||||||
|
call add(jobs, s:StatusLog(push . '..' . head, logs[-1]))
|
||||||
|
endif
|
||||||
|
|
||||||
if isdirectory(fugitive#Find('.git/rebase-merge/'))
|
if isdirectory(fugitive#Find('.git/rebase-merge/'))
|
||||||
let rebasing_dir = fugitive#Find('.git/rebase-merge/')
|
let rebasing_dir = fugitive#Find('.git/rebase-merge/')
|
||||||
elseif isdirectory(fugitive#Find('.git/rebase-apply/'))
|
elseif isdirectory(fugitive#Find('.git/rebase-apply/'))
|
||||||
@@ -2446,15 +2484,8 @@ function! fugitive#BufReadStatus() abort
|
|||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let diff = {'Staged': [], 'Unstaged': []}
|
call fugitive#Wait(jobs)
|
||||||
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 b:fugitive_diff = diff
|
||||||
let expanded = get(b:, 'fugitive_expanded', {'Staged': {}, 'Unstaged': {}})
|
let expanded = get(b:, 'fugitive_expanded', {'Staged': {}, 'Unstaged': {}})
|
||||||
let b:fugitive_expanded = {'Staged': {}, 'Unstaged': {}}
|
let b:fugitive_expanded = {'Staged': {}, 'Unstaged': {}}
|
||||||
@@ -2482,18 +2513,9 @@ function! fugitive#BufReadStatus() abort
|
|||||||
call s:AddSection('Staged', staged)
|
call s:AddSection('Staged', staged)
|
||||||
let staged_end = len(staged) ? line('$') : 0
|
let staged_end = len(staged) ? line('$') : 0
|
||||||
|
|
||||||
if len(pull) && get(props, 'branch.ab') !~# ' -0$'
|
for [title, log] in logs
|
||||||
call s:AddSection('Unpulled from ' . pull, s:QueryLog(head . '..' . pull))
|
call s:AddSection(title, log)
|
||||||
endif
|
endfor
|
||||||
if len(push) && push !=# pull
|
|
||||||
call s:AddSection('Unpulled from ' . push, s:QueryLog(head . '..' . push))
|
|
||||||
endif
|
|
||||||
if len(pull) && push !=# pull
|
|
||||||
call s:AddSection('Unpushed to ' . pull, s:QueryLog(pull . '..' . head))
|
|
||||||
endif
|
|
||||||
if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ')
|
|
||||||
call s:AddSection('Unpushed to ' . push, s:QueryLog(push . '..' . head))
|
|
||||||
endif
|
|
||||||
|
|
||||||
setlocal nomodified readonly noswapfile
|
setlocal nomodified readonly noswapfile
|
||||||
silent doautocmd BufReadPost
|
silent doautocmd BufReadPost
|
||||||
|
|||||||
Reference in New Issue
Block a user