@@ -238,7 +238,7 @@ impl HeadInfo {
238238pub struct CommitInfo {
239239 pub oid : Oid ,
240240 pub is_merge : bool ,
241- pub parents : [ Option < Oid > ; 2 ] ,
241+ pub parents : Vec < Oid > ,
242242 pub children : Vec < Oid > ,
243243 pub branches : Vec < usize > ,
244244 pub tags : Vec < usize > ,
@@ -247,10 +247,11 @@ pub struct CommitInfo {
247247
248248impl CommitInfo {
249249 fn new ( commit : & Commit ) -> Self {
250+ let parents = commit. parent_ids ( ) . collect ( ) ;
250251 CommitInfo {
251252 oid : commit. id ( ) ,
252253 is_merge : commit. parent_count ( ) > 1 ,
253- parents : [ commit . parent_id ( 0 ) . ok ( ) , commit . parent_id ( 1 ) . ok ( ) ] ,
254+ parents,
254255 children : Vec :: new ( ) ,
255256 branches : Vec :: new ( ) ,
256257 tags : Vec :: new ( ) ,
@@ -336,10 +337,10 @@ fn assign_children(commits: &mut [CommitInfo], indices: &HashMap<Oid, usize>) {
336337 for idx in 0 ..commits. len ( ) {
337338 let ( oid, parents) = {
338339 let info = & commits[ idx] ;
339- ( info. oid , info. parents )
340+ ( info. oid , info. parents . clone ( ) )
340341 } ;
341- for par_oid in & parents {
342- if let Some ( par_idx) = par_oid . and_then ( |oid| indices. get ( & oid ) ) {
342+ for par_oid in parents {
343+ if let Some ( par_idx) = indices. get ( & par_oid ) {
343344 commits[ * par_idx] . children . push ( oid) ;
344345 }
345346 }
@@ -503,9 +504,7 @@ fn assign_sources_targets(
503504 let mut max_par_order = None ;
504505 let mut source_branch_id = None ;
505506 for par_oid in info. parents . iter ( ) {
506- let par_info = par_oid
507- . and_then ( |oid| indices. get ( & oid) )
508- . and_then ( |idx| commits. get ( * idx) ) ;
507+ let par_info = indices. get ( par_oid) . and_then ( |idx| commits. get ( * idx) ) ;
509508 if let Some ( par_info) = par_info {
510509 if par_info. branch_trace != info. branch_trace {
511510 if let Some ( trace) = par_info. branch_trace {
@@ -966,6 +965,9 @@ fn branch_color<T: Clone>(
966965
967966/// Tries to extract the name of a merged-in branch from the merge commit summary.
968967pub fn parse_merge_summary ( summary : & str , patterns : & MergePatterns ) -> Option < String > {
968+ // TODO: Match octo-merge
969+ // Example with 3 parents, f1 is primary:
970+ // Merge branches 'f1', 'f2' and 'f3'
969971 for regex in & patterns. patterns {
970972 if let Some ( captures) = regex. captures ( summary) {
971973 if captures. len ( ) == 2 && captures. get ( 1 ) . is_some ( ) {
0 commit comments