summaryrefslogtreecommitdiffstats
path: root/modules/indexer
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-04-22 02:19:21 +0100
committerGitHub <noreply@github.com>2021-04-22 09:19:21 +0800
commitf719ffc783a71a5a23e356d4aa2a52717c022f4b (patch)
tree46cde5f9917781f669f233b9f4d7a530314281b6 /modules/indexer
parentdf416f24141000a5267c041b16e0413184b87b42 (diff)
downloadgitea-f719ffc783a71a5a23e356d4aa2a52717c022f4b.tar.gz
gitea-f719ffc783a71a5a23e356d4aa2a52717c022f4b.zip
If the default branch is not present do not report error on stats indexing (#15546)
* If the default branch is not present do not report error on stats indexing Fix #15257 Signed-off-by: Andrew Thornton <art27@cantab.net> * as per lunny Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules/indexer')
-rw-r--r--modules/indexer/stats/db.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/indexer/stats/db.go b/modules/indexer/stats/db.go
index bc3fbc13d8..3935c3ba75 100644
--- a/modules/indexer/stats/db.go
+++ b/modules/indexer/stats/db.go
@@ -38,7 +38,11 @@ func (db *DBIndexer) Index(id int64) error {
// Get latest commit for default branch
commitID, err := gitRepo.GetBranchCommitID(repo.DefaultBranch)
if err != nil {
- log.Error("Unable to get commit ID for defaultbranch %s in %s", repo.DefaultBranch, repo.RepoPath())
+ if git.IsErrBranchNotExist(err) {
+ log.Debug("Unable to get commit ID for defaultbranch %s in %s ... skipping this repository", repo.DefaultBranch, repo.RepoPath())
+ return nil
+ }
+ log.Error("Unable to get commit ID for defaultbranch %s in %s. Error: %v", repo.DefaultBranch, repo.RepoPath(), err)
return err
}