]> source.dussan.org Git - gitea.git/commitdiff
If the default branch is not present do not report error on stats indexing (follow...
authorzeripath <art27@cantab.net>
Thu, 22 Apr 2021 15:35:29 +0000 (16:35 +0100)
committerGitHub <noreply@github.com>
Thu, 22 Apr 2021 15:35:29 +0000 (17:35 +0200)
#15546 doesn't completely fix this problem because the error returned is an ObjectNotExist
error not a BranchNotExist error.

Add test for ErrObjectNotExist too

Fix #15257

Signed-off-by: Andrew Thornton <art27@cantab.net>
modules/indexer/stats/db.go

index 3935c3ba75c71a53760a3e75ccde5bc94b1d8343..976bf2d632d699816fa18ed1d82e2b5ee0f38f62 100644 (file)
@@ -38,7 +38,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) {
+               if git.IsErrBranchNotExist(err) || git.IsErrNotExist((err)) {
                        log.Debug("Unable to get commit ID for defaultbranch %s in %s ... skipping this repository", repo.DefaultBranch, repo.RepoPath())
                        return nil
                }