1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-12 05:27:20 +00:00

Speed up enry.IsVendor (#15213) (#15246)

Backport #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>
This commit is contained in:
zeripath
2021-04-01 23:50:12 +01:00
committed by GitHub
parent 1062931cf1
commit 1a26f6c7ab
5 changed files with 115 additions and 3 deletions

View File

@ -175,7 +175,7 @@ func NewBleveIndexer(indexDir string) (*BleveIndexer, bool, error) {
func (b *BleveIndexer) addUpdate(commitSha string, update fileUpdate, repo *models.Repository, batch rupture.FlushingBatch) error {
// Ignore vendored files in code search
if setting.Indexer.ExcludeVendored && enry.IsVendor(update.Filename) {
if setting.Indexer.ExcludeVendored && analyze.IsVendor(update.Filename) {
return nil
}