@@ -238,7 +238,7 @@ impl HeadInfo {
238
238
pub struct CommitInfo {
239
239
pub oid : Oid ,
240
240
pub is_merge : bool ,
241
- pub parents : [ Option < Oid > ; 2 ] ,
241
+ pub parents : Vec < Oid > ,
242
242
pub children : Vec < Oid > ,
243
243
pub branches : Vec < usize > ,
244
244
pub tags : Vec < usize > ,
@@ -247,10 +247,11 @@ pub struct CommitInfo {
247
247
248
248
impl CommitInfo {
249
249
fn new ( commit : & Commit ) -> Self {
250
+ let parents = commit. parent_ids ( ) . collect ( ) ;
250
251
CommitInfo {
251
252
oid : commit. id ( ) ,
252
253
is_merge : commit. parent_count ( ) > 1 ,
253
- parents : [ commit . parent_id ( 0 ) . ok ( ) , commit . parent_id ( 1 ) . ok ( ) ] ,
254
+ parents,
254
255
children : Vec :: new ( ) ,
255
256
branches : Vec :: new ( ) ,
256
257
tags : Vec :: new ( ) ,
@@ -336,10 +337,10 @@ fn assign_children(commits: &mut [CommitInfo], indices: &HashMap<Oid, usize>) {
336
337
for idx in 0 ..commits. len ( ) {
337
338
let ( oid, parents) = {
338
339
let info = & commits[ idx] ;
339
- ( info. oid , info. parents )
340
+ ( info. oid , info. parents . clone ( ) )
340
341
} ;
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 ) {
343
344
commits[ * par_idx] . children . push ( oid) ;
344
345
}
345
346
}
@@ -503,9 +504,7 @@ fn assign_sources_targets(
503
504
let mut max_par_order = None ;
504
505
let mut source_branch_id = None ;
505
506
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) ) ;
509
508
if let Some ( par_info) = par_info {
510
509
if par_info. branch_trace != info. branch_trace {
511
510
if let Some ( trace) = par_info. branch_trace {
@@ -966,6 +965,9 @@ fn branch_color<T: Clone>(
966
965
967
966
/// Tries to extract the name of a merged-in branch from the merge commit summary.
968
967
pub 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'
969
971
for regex in & patterns. patterns {
970
972
if let Some ( captures) = regex. captures ( summary) {
971
973
if captures. len ( ) == 2 && captures. get ( 1 ) . is_some ( ) {
0 commit comments