You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2023/08/09 05:07:24 UTC
[incubator-devlake] branch release-v0.18 updated: fix: add SKIP_COMMIT_FILES enviroment variable (#5838)
This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch release-v0.18
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.18 by this push:
new 2bcccdf9e fix: add SKIP_COMMIT_FILES enviroment variable (#5838)
2bcccdf9e is described below
commit 2bcccdf9e7ae51cad6c2a017b7fd8a80885b693b
Author: abeizn <zi...@merico.dev>
AuthorDate: Wed Aug 9 12:59:53 2023 +0800
fix: add SKIP_COMMIT_FILES enviroment variable (#5838)
* fix: add SKIP_COMMIT_FILES enviroment variable
* fix: use GetBool replace GetString
---
backend/plugins/gitextractor/parser/repo.go | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/backend/plugins/gitextractor/parser/repo.go b/backend/plugins/gitextractor/parser/repo.go
index 18e0b9bf1..d1d6b5805 100644
--- a/backend/plugins/gitextractor/parser/repo.go
+++ b/backend/plugins/gitextractor/parser/repo.go
@@ -22,6 +22,11 @@ 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"
@@ -29,13 +34,12 @@ import (
"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 {
@@ -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()