summaryrefslogtreecommitdiffstats
path: root/modules/git
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-04-01 18:41:09 +0100
committerGitHub <noreply@github.com>2021-04-01 19:41:09 +0200
commitff460ca74d37b1eadac63b8858d0daa1690e0e2f (patch)
tree3a04e464fc5e4e6630b31fe4444dd007eb52f799 /modules/git
parent43fb4921e3fb67be9f2f3a6d631a21a3322f492b (diff)
downloadgitea-ff460ca74d37b1eadac63b8858d0daa1690e0e2f.tar.gz
gitea-ff460ca74d37b1eadac63b8858d0daa1690e0e2f.zip
Speed up `enry.IsVendor` (#15213)
`enry.IsVendor` is kinda slow as it simply iterates across all regexps. This PR ajdusts the regexps to combine them to make this process a little quicker. Related #15143 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/repo_language_stats_gogit.go2
-rw-r--r--modules/git/repo_language_stats_nogogit.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/modules/git/repo_language_stats_gogit.go b/modules/git/repo_language_stats_gogit.go
index b5a235921c..20a7b061f2 100644
--- a/modules/git/repo_language_stats_gogit.go
+++ b/modules/git/repo_language_stats_gogit.go
@@ -43,7 +43,7 @@ func (repo *Repository) GetLanguageStats(commitID string) (map[string]int64, err
sizes := make(map[string]int64)
err = tree.Files().ForEach(func(f *object.File) error {
- if f.Size == 0 || enry.IsVendor(f.Name) || enry.IsDotFile(f.Name) ||
+ if f.Size == 0 || analyze.IsVendor(f.Name) || enry.IsDotFile(f.Name) ||
enry.IsDocumentation(f.Name) || enry.IsConfiguration(f.Name) {
return nil
}
diff --git a/modules/git/repo_language_stats_nogogit.go b/modules/git/repo_language_stats_nogogit.go
index a929d7953b..3f197f8d74 100644
--- a/modules/git/repo_language_stats_nogogit.go
+++ b/modules/git/repo_language_stats_nogogit.go
@@ -67,7 +67,7 @@ func (repo *Repository) GetLanguageStats(commitID string) (map[string]int64, err
for _, f := range entries {
contentBuf.Reset()
content = contentBuf.Bytes()
- if f.Size() == 0 || enry.IsVendor(f.Name()) || enry.IsDotFile(f.Name()) ||
+ if f.Size() == 0 || analyze.IsVendor(f.Name()) || enry.IsDotFile(f.Name()) ||
enry.IsDocumentation(f.Name()) || enry.IsConfiguration(f.Name()) {
continue
}