mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-08 11:33:47 -05:00
Fix race conditions generating sequencer sections
Resolves: https://github.com/tpope/vim-fugitive/issues/2411
This commit is contained in:
@@ -2937,20 +2937,34 @@ function! s:StatusRender(stat) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let sequencing = []
|
let sequencing = []
|
||||||
if filereadable(fugitive#Find('.git/sequencer/todo', dir))
|
try
|
||||||
for line in reverse(readfile(fugitive#Find('.git/sequencer/todo', dir)))
|
let sequencer_todo = reverse(readfile(fugitive#Find('.git/sequencer/todo', dir)))
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
|
if exists('sequencer_todo')
|
||||||
|
for line in sequencer_todo
|
||||||
let match = matchlist(line, '^\(\l\+\)\s\+\(\x\{4,\}\)\s\+\(.*\)')
|
let match = matchlist(line, '^\(\l\+\)\s\+\(\x\{4,\}\)\s\+\(.*\)')
|
||||||
if len(match) && match[1] !~# 'exec\|merge\|label'
|
if len(match) && match[1] !~# 'exec\|merge\|label'
|
||||||
call add(sequencing, {'type': 'Rebase', 'status': get(s:rebase_abbrevs, match[1], match[1]), 'commit': match[2], 'subject': match[3]})
|
call add(sequencing, {'type': 'Rebase', 'status': get(s:rebase_abbrevs, match[1], match[1]), 'commit': match[2], 'subject': match[3]})
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
elseif filereadable(fugitive#Find('.git/MERGE_MSG', dir))
|
else
|
||||||
|
try
|
||||||
|
let merge_msg = get(readfile(fugitive#Find('.git/MERGE_MSG', dir)), 0, '')
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
if exists('merge_msg')
|
||||||
if filereadable(fugitive#Find('.git/CHERRY_PICK_HEAD', dir))
|
if filereadable(fugitive#Find('.git/CHERRY_PICK_HEAD', dir))
|
||||||
let pick_head = fugitive#Execute(['rev-parse', '--short', 'CHERRY_PICK_HEAD', '--'], dir).stdout[0]
|
let pick_head = fugitive#Execute(['rev-parse', '--short', 'CHERRY_PICK_HEAD', '--'], dir).stdout[0]
|
||||||
call add(sequencing, {'type': 'Rebase', 'status': 'pick', 'commit': pick_head, 'subject': get(readfile(fugitive#Find('.git/MERGE_MSG', dir)), 0, '')})
|
if !empty(pick_head)
|
||||||
|
call add(sequencing, {'type': 'Rebase', 'status': 'pick', 'commit': pick_head, 'subject': merge_msg})
|
||||||
|
endif
|
||||||
elseif filereadable(fugitive#Find('.git/REVERT_HEAD', dir))
|
elseif filereadable(fugitive#Find('.git/REVERT_HEAD', dir))
|
||||||
let pick_head = fugitive#Execute(['rev-parse', '--short', 'REVERT_HEAD', '--'], dir).stdout[0]
|
let pick_head = fugitive#Execute(['rev-parse', '--short', 'REVERT_HEAD', '--'], dir).stdout[0]
|
||||||
call add(sequencing, {'type': 'Rebase', 'status': 'revert', 'commit': pick_head, 'subject': get(readfile(fugitive#Find('.git/MERGE_MSG', dir)), 0, '')})
|
if !empty(pick_head)
|
||||||
|
call add(sequencing, {'type': 'Rebase', 'status': 'revert', 'commit': pick_head, 'subject': merge_msg})
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user