Skip to content

Commit

Permalink
fix: add SKIP_COMMIT_FILES enviroment variable (#5838)
Browse files Browse the repository at this point in the history
* fix: add SKIP_COMMIT_FILES enviroment variable

* fix: use GetBool replace GetString
  • Loading branch information
abeizn committed Aug 9, 2023
1 parent 8fdaa33 commit 4154a8f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions backend/plugins/gitextractor/parser/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,24 @@ import (
"crypto/sha256"
"encoding/hex"
"fmt"
"regexp"
"sort"
"strconv"

"github.com/apache/incubator-devlake/core/config"
"github.com/apache/incubator-devlake/core/dal"
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/log"
"github.com/apache/incubator-devlake/core/models/domainlayer"
"github.com/apache/incubator-devlake/core/models/domainlayer/code"
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/plugins/gitextractor/models"
"regexp"
"sort"
"strconv"

git "github.com/libgit2/git2go/v33"
)

const SkipCommitFiles = "SKIP_COMMIT_FILES"

var TypeNotMatchError = "the requested type does not match the type in the ODB"

type GitRepo struct {
Expand Down Expand Up @@ -331,9 +335,13 @@ func (r *GitRepo) getDiffComparedToParent(commitSha string, commit *git.Commit,
if err != nil {
return nil, errors.Convert(err)
}
err = r.storeCommitFilesFromDiff(commitSha, diff, componentMap)
if err != nil {
return nil, errors.Convert(err)
cfg := config.GetConfig()
skipCommitFiles := cfg.GetBool(SkipCommitFiles)
if !skipCommitFiles {
err = r.storeCommitFilesFromDiff(commitSha, diff, componentMap)
if err != nil {
return nil, errors.Convert(err)
}
}
var stats *git.DiffStats
stats, err = diff.Stats()
Expand Down

0 comments on commit 4154a8f

Please sign in to comment.