@@ -640,20 +640,22 @@ function(_yargs, d3, demos) {
640640 }
641641
642642 // determine which commits the local repo is missing from the origin
643+ function checkCommit ( commit , branch ) {
644+ var notInLocal = local . getCommit ( commit . id ) === null
645+ if ( notInLocal && commit . id ) {
646+ if ( fetchIds . indexOf ( commit . id ) === - 1 ) {
647+ fetchCommits . unshift ( commit )
648+ fetchIds . unshift ( commit . id )
649+ }
650+ fetchBranches [ branch ] += 1
651+ commit . parent && checkCommit ( origin . getCommit ( commit . parent ) , branch )
652+ commit . parent2 && checkCommit ( origin . getCommit ( commit . parent2 ) , branch )
653+ }
654+ }
655+
643656 for ( fb in fetchBranches ) {
644657 if ( origin . branches . indexOf ( fb ) > - 1 ) {
645- fetchCommit = origin . getCommit ( fb ) ;
646-
647- var notInLocal = local . getCommit ( fetchCommit . id ) === null ;
648- while ( notInLocal ) {
649- if ( fetchIds . indexOf ( fetchCommit . id ) === - 1 ) {
650- fetchCommits . unshift ( fetchCommit ) ;
651- fetchIds . unshift ( fetchCommit . id ) ;
652- }
653- fetchBranches [ fb ] += 1 ;
654- fetchCommit = origin . getCommit ( fetchCommit . parent ) ;
655- notInLocal = local . getCommit ( fetchCommit . id ) === null ;
656- }
658+ checkCommit ( origin . getCommit ( fb ) )
657659 }
658660 }
659661
@@ -663,6 +665,7 @@ function(_yargs, d3, demos) {
663665 local . commitData . push ( {
664666 id : fetchCommit . id ,
665667 parent : fetchCommit . parent ,
668+ parent2 : fetchCommit . parent2 ,
666669 tags : [ ]
667670 } ) ;
668671 }
0 commit comments