@@ -210,42 +210,42 @@ def rebase_mappings
210210 preload_threads . each ( &:join )
211211
212212 local_branches = local_branches . sort_by do |branch |
213- seq_mr_match_data = seq_mr_pattern . match ( branch )
214- backport_match_data = backport_pattern . match ( branch )
215- mr_match_data = mr_pattern . match ( branch )
216-
217- if seq_mr_match_data
218- # Sort by: [branch_distance, mr_id, seq_nr, branch_name]
219- # This ensures branches are grouped by MR and ordered by sequence within each MR
220- [
221- branch_distance ( branch , default_branch ) ,
222- seq_mr_match_data [ :mr_id ] . to_i ,
223- seq_mr_match_data [ :mr_seq_nr ] . to_i ,
224- branch
225- ]
226- elsif backport_match_data
227- [
228- branch_distance ( branch , default_branch ) ,
229- backport_match_data [ :mr_id ] . to_i ,
230- 999 , # Put backport branches after sequenced branches
231- backport_match_data [ :milestone ] . tr ( "." , "-" ) . to_f
232- ]
233- elsif mr_match_data
234- [
235- branch_distance ( branch , default_branch ) ,
236- mr_match_data [ :mr_id ] . to_i ,
237- 999 , # Put non-sequenced branches after sequenced branches
238- branch
239- ]
240- else
241- [
242- branch_distance ( branch , default_branch ) ,
243- 999_999 , # Put non-MR branches last
244- 999 ,
245- branch
246- ]
247- end
213+ seq_mr_match_data = seq_mr_pattern . match ( branch )
214+ backport_match_data = backport_pattern . match ( branch )
215+ mr_match_data = mr_pattern . match ( branch )
216+
217+ if seq_mr_match_data
218+ # Sort by: [branch_distance, mr_id, seq_nr, branch_name]
219+ # This ensures branches are grouped by MR and ordered by sequence within each MR
220+ [
221+ branch_distance ( branch , default_branch ) ,
222+ seq_mr_match_data [ :mr_id ] . to_i ,
223+ seq_mr_match_data [ :mr_seq_nr ] . to_i ,
224+ branch
225+ ]
226+ elsif backport_match_data
227+ [
228+ branch_distance ( branch , default_branch ) ,
229+ backport_match_data [ :mr_id ] . to_i ,
230+ 999 , # Put backport branches after sequenced branches
231+ backport_match_data [ :milestone ] . tr ( "." , "-" ) . to_f
232+ ]
233+ elsif mr_match_data
234+ [
235+ branch_distance ( branch , default_branch ) ,
236+ mr_match_data [ :mr_id ] . to_i ,
237+ 999 , # Put non-sequenced branches after sequenced branches
238+ branch
239+ ]
240+ else
241+ [
242+ branch_distance ( branch , default_branch ) ,
243+ 999_999 , # Put non-MR branches last
244+ 999 ,
245+ branch
246+ ]
248247 end
248+ end
249249
250250 mr_seq_branches = { }
251251
@@ -431,10 +431,8 @@ def deleted_branch_tip_from_reflog(branch_name_prefix, descendant_branch = nil)
431431 /\b checkout: moving from .+ to #{ escaped } /
432432 ]
433433
434- reflog_cmd = %W[
435- git reflog --format=%H\ %gs
436- --grep-reflog=checkout.*#{ branch_name_prefix }
437- --grep-reflog=rebase.*#{ branch_name_prefix }
434+ reflog_cmd = [
435+ "git" , "reflog" , "--format=%H %gs" , "--grep-reflog=checkout.*#{ branch_name_prefix } " , "--grep-reflog=rebase.*#{ branch_name_prefix } "
438436 ]
439437
440438 IO . popen ( reflog_cmd ) do |io |
@@ -493,7 +491,7 @@ def rebase_all
493491 mappings = rebase_mappings
494492 . sort_by { |b | [ branch_distance ( b [ :branch ] , default_branch ) , branch_sort_key ( b ) ] }
495493 . to_h { |b | [ b [ :branch ] , { rebase_onto : b [ :rebase_onto ] , fork_point : b [ :fork_point ] } ] }
496- rebase_all_per_capture_info ( mappings )
494+ exit ( 1 ) if rebase_all_per_capture_info ( mappings ) == false
497495end
498496
499497def git_push_issue ( *args )
@@ -533,7 +531,7 @@ def git_push_issue(*args)
533531
534532 puts "Pushing " . brown + branches . map ( &:cyan ) . join ( ", " ) + " to " . brown + active_remote_name . green + "..." . brown
535533
536- system ( *%W[ git push --force-with-lease #{ active_remote_name } ] , *branches , *args )
534+ exit ( 1 ) unless system ( *%W[ git push --force-with-lease #{ active_remote_name } ] , *branches , *args )
537535end
538536
539537def changed_branch_files ( format : nil )
0 commit comments