diff options
Diffstat (limited to 'modules/indexer/stats/db.go')
-rw-r--r-- | modules/indexer/stats/db.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/indexer/stats/db.go b/modules/indexer/stats/db.go index 9bbdcad60d..2a0475dea6 100644 --- a/modules/indexer/stats/db.go +++ b/modules/indexer/stats/db.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/modules/graceful" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/process" + "code.gitea.io/gitea/modules/setting" ) // DBIndexer implements Indexer interface to use database's like search @@ -46,7 +47,7 @@ func (db *DBIndexer) Index(id int64) error { // Get latest commit for default branch commitID, err := gitRepo.GetBranchCommitID(repo.DefaultBranch) if err != nil { - if git.IsErrBranchNotExist(err) || git.IsErrNotExist(err) { + if git.IsErrBranchNotExist(err) || git.IsErrNotExist(err) || setting.IsInTesting { log.Debug("Unable to get commit ID for default branch %s in %s ... skipping this repository", repo.DefaultBranch, repo.RepoPath()) return nil } @@ -62,7 +63,9 @@ func (db *DBIndexer) Index(id int64) error { // Calculate and save language statistics to database stats, err := gitRepo.GetLanguageStats(commitID) if err != nil { - log.Error("Unable to get language stats for ID %s for default branch %s in %s. Error: %v", commitID, repo.DefaultBranch, repo.RepoPath(), err) + if !setting.IsInTesting { + log.Error("Unable to get language stats for ID %s for default branch %s in %s. Error: %v", commitID, repo.DefaultBranch, repo.RepoPath(), err) + } return err } err = repo_model.UpdateLanguageStats(repo, commitID, stats) |