@@ -22,20 +22,24 @@ import (
2222 "crypto/sha256"
2323 "encoding/hex"
2424 "fmt"
25+ "regexp"
26+ "sort"
27+ "strconv"
28+
29+ "github.com/apache/incubator-devlake/core/config"
2530 "github.com/apache/incubator-devlake/core/dal"
2631 "github.com/apache/incubator-devlake/core/errors"
2732 "github.com/apache/incubator-devlake/core/log"
2833 "github.com/apache/incubator-devlake/core/models/domainlayer"
2934 "github.com/apache/incubator-devlake/core/models/domainlayer/code"
3035 "github.com/apache/incubator-devlake/core/plugin"
3136 "github.com/apache/incubator-devlake/plugins/gitextractor/models"
32- "regexp"
33- "sort"
34- "strconv"
3537
3638 git "github.com/libgit2/git2go/v33"
3739)
3840
41+ const SkipCommitFiles = "SKIP_COMMIT_FILES"
42+
3943var TypeNotMatchError = "the requested type does not match the type in the ODB"
4044
4145type GitRepo struct {
@@ -331,9 +335,13 @@ func (r *GitRepo) getDiffComparedToParent(commitSha string, commit *git.Commit,
331335 if err != nil {
332336 return nil , errors .Convert (err )
333337 }
334- err = r .storeCommitFilesFromDiff (commitSha , diff , componentMap )
335- if err != nil {
336- return nil , errors .Convert (err )
338+ cfg := config .GetConfig ()
339+ skipCommitFiles := cfg .GetBool (SkipCommitFiles )
340+ if ! skipCommitFiles {
341+ err = r .storeCommitFilesFromDiff (commitSha , diff , componentMap )
342+ if err != nil {
343+ return nil , errors .Convert (err )
344+ }
337345 }
338346 var stats * git.DiffStats
339347 stats , err = diff .Stats ()
0 commit comments