@@ -105,11 +105,17 @@ export async function getCommitsSince(
105105 args . push ( since ) ;
106106 args . push ( "HEAD" ) ;
107107 } else {
108- const days = parseInt ( since , 10 ) ;
109- if ( isPureNumber && ! isNaN ( days ) ) {
108+ const daysStr = since . toLowerCase ( ) ;
109+ if ( daysStr . endsWith ( "d" ) ) {
110+ const days = daysStr . slice ( 0 , - 1 ) ;
110111 args . push ( `--since=${ days } days ago` ) ;
111112 } else {
112- args . push ( `--since=${ since } ` ) ;
113+ const days = parseInt ( since , 10 ) ;
114+ if ( isPureNumber && ! isNaN ( days ) ) {
115+ args . push ( `--since=${ days } days ago` ) ;
116+ } else {
117+ args . push ( `--since=${ since } ` ) ;
118+ }
113119 }
114120 }
115121 }
@@ -120,17 +126,37 @@ export async function getCommitsSince(
120126
121127 const logResult = await git . log ( args ) ;
122128
129+ // Fetch parents separately to avoid breaking simple-git's diff parser
130+ const parentArgs = args . filter ( arg => ! arg . startsWith ( '--stat' ) ) ;
131+ const parentsRaw = await git . raw ( [ 'log' , ...parentArgs , '--format=%H %P' ] ) ;
132+ const parentMap = new Map < string , string [ ] > ( ) ;
133+
134+ parentsRaw . split ( '\n' ) . forEach ( line => {
135+ const parts = line . trim ( ) . split ( ' ' ) ;
136+ const hash = parts [ 0 ] ;
137+ if ( hash ) {
138+ parentMap . set ( hash , parts . slice ( 1 ) ) ;
139+ }
140+ } ) ;
141+
123142 return logResult . all . map ( ( commit : any ) => {
143+ const hash = commit . hash ;
144+ const parents = parentMap . get ( hash ) || [ ] ;
145+ // Combine subject and body for full message analysis
146+ const fullMessage = commit . body ? `${ commit . message } \n\n${ commit . body } ` : commit . message ;
147+
124148 return {
125- hash : commit . hash ,
126- parents : commit . parents || [ ] ,
149+ hash,
150+ parents,
127151 author : {
128152 name : commit . author_name || 'Unknown' ,
129153 email : commit . author_email || 'unknown@example.com'
130154 } ,
131155 date : commit . date ,
132- message : commit . message ,
133- files : commit . diff ? commit . diff . files . map ( ( f : any ) => f . file ) . filter ( Boolean ) : [ ]
156+ message : fullMessage ,
157+ files : commit . diff ? commit . diff . files . map ( ( f : any ) => f . file ) . filter ( Boolean ) : [ ] ,
158+ insertions : commit . diff ?. insertions || 0 ,
159+ deletions : commit . diff ?. deletions || 0
134160 } as GitCommit ;
135161 } ) ;
136162}
0 commit comments