@@ -1301,24 +1301,26 @@ class Gren {
13011301 // 1) Build quick lookup
13021302 const commitMap = new Map ( commits . map ( ( c ) => [ c . sha , c ] ) ) ;
13031303
1304- // 2) Compute in‑list parents for each commit
1304+ // 2) Compute parents for each commit
13051305 const parentMap = new Map ( ) ;
13061306 for ( const c of commits ) {
1307- const inList = ( c . parents || [ ] ) . map ( ( p ) => p . sha ) . filter ( ( sha ) => commitMap . has ( sha ) ) ;
1308- parentMap . set ( c . sha , inList ) ;
1307+ const parentList = ( c . parents || [ ] ) . map ( ( p ) => p . sha ) . filter ( ( sha ) => commitMap . has ( sha ) ) ;
1308+ parentMap . set ( c . sha , parentList ) ;
13091309 }
13101310
1311- // 3) Compute which SHAs appear as a parent → those that have children
1311+ // 3) Compute which SHAs appear as a parent -> those that have children
13121312 const hasChild = new Set ( ) ;
13131313 for ( const parents of parentMap . values ( ) ) {
1314- for ( const p of parents ) hasChild . add ( p ) ;
1314+ for ( const p of parents ) {
1315+ hasChild . add ( p ) ;
1316+ }
13151317 }
13161318
13171319 // 4) Heads = commits that never appear as anyone’s parent
13181320 const heads = commits . filter ( ( c ) => ! hasChild . has ( c . sha ) ) . map ( ( c ) => c . sha ) ;
13191321
13201322 // 5) A helper to compare by newest date
1321- const compareDateDesc = ( shaA ) => ( shaB ) => {
1323+ const compareDateDesc = ( shaA , shaB ) => {
13221324 const da = new Date (
13231325 commitMap . get ( shaA ) . commit . committer . date || commitMap . get ( shaA ) . commit . author . date ,
13241326 ) ;
@@ -1335,7 +1337,7 @@ class Gren {
13351337
13361338 while ( pool . length ) {
13371339 // pick the newest SHA
1338- pool . sort ( ( a , b ) => compareDateDesc ( a ) ( b ) ) ;
1340+ pool . sort ( ( a , b ) => compareDateDesc ( a , b ) ) ;
13391341 const sha = pool . shift ( ) ;
13401342
13411343 if ( seen . has ( sha ) ) continue ;
@@ -1344,7 +1346,7 @@ class Gren {
13441346 // emit that commit
13451347 result . push ( commitMap . get ( sha ) ) ;
13461348
1347- // add its in‑list parents to the pool
1349+ // add its parents to the pool
13481350 for ( const p of parentMap . get ( sha ) || [ ] ) {
13491351 if ( ! seen . has ( p ) ) pool . push ( p ) ;
13501352 }
0 commit comments