@@ -202,6 +202,7 @@ func transform(src *object.Commit, tag *object.Tag) (dst *Commit) {
202
202
func (impl RepositoryManagerAnalyticsImpl ) ChangesSinceByRepositoryForAnalytics (gitCtx GitContext , checkoutPath string , Old string , New string ) (* GitChanges , error ) {
203
203
var err error
204
204
start := time .Now ()
205
+ useGitCli := impl .configuration .UseGitCli || impl .configuration .UseGitCliAnalytics
205
206
defer func () {
206
207
util .TriggerGitOperationMetrics ("changesSinceByRepositoryForAnalytics" , start , err )
207
208
}()
@@ -214,7 +215,7 @@ func (impl RepositoryManagerAnalyticsImpl) ChangesSinceByRepositoryForAnalytics(
214
215
oldHash := plumbing .NewHash (Old )
215
216
216
217
var fileStats FileStats
217
- if strings .Contains (checkoutPath , "/.git" ) || impl . configuration . UseGitCli {
218
+ if strings .Contains (checkoutPath , "/.git" ) || useGitCli {
218
219
oldHashString := oldHash .String ()
219
220
newHashString := newHash .String ()
220
221
fileStats , err = impl .gitManager .FetchDiffStatBetweenCommitsWithNumstat (gitCtx , oldHashString , newHashString , checkoutPath )
@@ -243,14 +244,17 @@ func (impl RepositoryManagerAnalyticsImpl) ChangesSinceByRepositoryForAnalytics(
243
244
func (impl RepositoryManagerAnalyticsImpl ) computeCommitDiff (gitCtx GitContext , checkoutPath string , oldHash plumbing.Hash , newHash plumbing.Hash , repository * GitRepository ) ([]* Commit , error ) {
244
245
var commitsCli , commitsGoGit []* Commit
245
246
var err error
246
- if impl .configuration .UseGitCli || impl .configuration .AnalyticsDebug {
247
+ useGitCli := impl .configuration .UseGitCli || impl .configuration .UseGitCliAnalytics
248
+ if useGitCli || impl .configuration .AnalyticsDebug {
249
+ impl .logger .Infow ("Computing commit diff using cli " , "checkoutPath" , checkoutPath )
247
250
commitsCli , err = impl .gitManager .LogMergeBase (gitCtx , checkoutPath , oldHash .String (), newHash .String ())
248
251
if err != nil {
249
252
impl .logger .Errorw ("error in fetching commits for analytics through CLI: " , "err" , err )
250
253
return nil , err
251
254
}
252
255
}
253
- if ! impl .configuration .UseGitCli || impl .configuration .AnalyticsDebug {
256
+ if ! useGitCli || impl .configuration .AnalyticsDebug {
257
+ impl .logger .Infow ("Computing commit diff using go-git " , "checkoutPath" , checkoutPath )
254
258
ctx , cancel := gitCtx .WithTimeout (impl .configuration .GoGitTimeout )
255
259
defer cancel ()
256
260
commitsGoGit , err = RunWithTimeout (ctx , func () ([]* Commit , error ) {
@@ -265,7 +269,7 @@ func (impl RepositoryManagerAnalyticsImpl) computeCommitDiff(gitCtx GitContext,
265
269
impl .logOldestCommitComparison (commitsGoGit , commitsCli , checkoutPath , oldHash .String (), newHash .String ())
266
270
}
267
271
268
- if ! impl . configuration . UseGitCli {
272
+ if ! useGitCli {
269
273
return commitsGoGit , nil
270
274
}
271
275
return commitsCli , nil
0 commit comments