@@ -2937,20 +2937,34 @@ function! s:StatusRender(stat) abort
29372937 endif
29382938
29392939 let sequencing = []
2940- if filereadable (fugitive#Find (' .git/sequencer/todo' , dir ))
2941- for line in reverse (readfile (fugitive#Find (' .git/sequencer/todo' , dir )))
2940+ try
2941+ let sequencer_todo = reverse (readfile (fugitive#Find (' .git/sequencer/todo' , dir )))
2942+ catch
2943+ endtry
2944+ if exists (' sequencer_todo' )
2945+ for line in sequencer_todo
29422946 let match = matchlist (line , ' ^\(\l\+\)\s\+\(\x\{4,\}\)\s\+\(.*\)' )
29432947 if len (match ) && match [1 ] !~# ' exec\|merge\|label'
29442948 call add (sequencing, {' type' : ' Rebase' , ' status' : get (s: rebase_abbrevs , match [1 ], match [1 ]), ' commit' : match [2 ], ' subject' : match [3 ]})
29452949 endif
29462950 endfor
2947- elseif filereadable (fugitive#Find (' .git/MERGE_MSG' , dir ))
2951+ else
2952+ try
2953+ let merge_msg = get (readfile (fugitive#Find (' .git/MERGE_MSG' , dir )), 0 , ' ' )
2954+ catch
2955+ endtry
2956+ endif
2957+ if exists (' merge_msg' )
29482958 if filereadable (fugitive#Find (' .git/CHERRY_PICK_HEAD' , dir ))
29492959 let pick_head = fugitive#Execute ([' rev-parse' , ' --short' , ' CHERRY_PICK_HEAD' , ' --' ], dir ).stdout[0 ]
2950- call add (sequencing, {' type' : ' Rebase' , ' status' : ' pick' , ' commit' : pick_head, ' subject' : get (readfile (fugitive#Find (' .git/MERGE_MSG' , dir )), 0 , ' ' )})
2960+ if ! empty (pick_head)
2961+ call add (sequencing, {' type' : ' Rebase' , ' status' : ' pick' , ' commit' : pick_head, ' subject' : merge_msg})
2962+ endif
29512963 elseif filereadable (fugitive#Find (' .git/REVERT_HEAD' , dir ))
29522964 let pick_head = fugitive#Execute ([' rev-parse' , ' --short' , ' REVERT_HEAD' , ' --' ], dir ).stdout[0 ]
2953- call add (sequencing, {' type' : ' Rebase' , ' status' : ' revert' , ' commit' : pick_head, ' subject' : get (readfile (fugitive#Find (' .git/MERGE_MSG' , dir )), 0 , ' ' )})
2965+ if ! empty (pick_head)
2966+ call add (sequencing, {' type' : ' Rebase' , ' status' : ' revert' , ' commit' : pick_head, ' subject' : merge_msg})
2967+ endif
29542968 endif
29552969 endif
29562970
0 commit comments