@@ -214,7 +214,17 @@ func (impl RepositoryManagerAnalyticsImpl) ChangesSinceByRepositoryForAnalytics(
214
214
GitChanges .FileStats = fileStats
215
215
impl .logger .Debugw ("computed files stats" , "filestats" , fileStats )
216
216
217
+ commits , err := impl .computeCommitDiff (gitCtx , checkoutPath , oldHash , newHash , repository )
218
+ if err != nil {
219
+ return nil , err
220
+ }
221
+ GitChanges .Commits = commits
222
+ return GitChanges , nil
223
+ }
224
+
225
+ func (impl RepositoryManagerAnalyticsImpl ) computeCommitDiff (gitCtx GitContext , checkoutPath string , oldHash plumbing.Hash , newHash plumbing.Hash , repository * GitRepository ) ([]* Commit , error ) {
217
226
var commitsCli , commitsGoGit []* Commit
227
+ var err error
218
228
if impl .configuration .UseGitCli || impl .configuration .AnalyticsDebug {
219
229
commitsCli , err = impl .gitManager .LogMergeBase (gitCtx , checkoutPath , oldHash .String (), newHash .String ())
220
230
if err != nil {
@@ -234,15 +244,13 @@ func (impl RepositoryManagerAnalyticsImpl) ChangesSinceByRepositoryForAnalytics(
234
244
}
235
245
}
236
246
if impl .configuration .AnalyticsDebug {
237
- impl .logOldestCommitComparison (commitsGoGit , commitsCli , checkoutPath , Old , New )
247
+ impl .logOldestCommitComparison (commitsGoGit , commitsCli , checkoutPath , oldHash . String (), newHash . String () )
238
248
}
239
249
240
250
if ! impl .configuration .UseGitCli {
241
- GitChanges .Commits = commitsGoGit
242
- } else {
243
- GitChanges .Commits = commitsCli
251
+ return commitsGoGit , nil
244
252
}
245
- return GitChanges , nil
253
+ return commitsCli , nil
246
254
}
247
255
248
256
func (impl RepositoryManagerAnalyticsImpl ) logOldestCommitComparison (commitsGoGit []* Commit , commitsCli []* Commit , checkoutPath string , old string , new string ) {
@@ -324,29 +332,8 @@ func processGitLogOutputForAnalytics(out string) ([]*Commit, error) {
324
332
if err != nil {
325
333
return gitCommits , err
326
334
}
327
-
328
335
for _ , formattedCommit := range gitCommitFormattedList {
329
-
330
- cm := Commit {
331
- Hash : & Hash {
332
- Long : formattedCommit .Commit ,
333
- },
334
- Author : & Author {
335
- Name : formattedCommit .Author .Name ,
336
- Email : formattedCommit .Author .Email ,
337
- Date : formattedCommit .Author .Date ,
338
- },
339
- Committer : & Committer {
340
- Name : formattedCommit .Commiter .Name ,
341
- Email : formattedCommit .Commiter .Email ,
342
- Date : formattedCommit .Commiter .Date ,
343
- },
344
- Tag : & Tag {},
345
- Tree : & Tree {},
346
- Subject : formattedCommit .Subject ,
347
- Body : formattedCommit .Body ,
348
- }
349
- gitCommits = append (gitCommits , & cm )
336
+ gitCommits = append (gitCommits , formattedCommit .transformToCommit ())
350
337
}
351
338
return gitCommits , nil
352
339
}
0 commit comments