diff --git a/modules/indexer/stats/db.go b/modules/indexer/stats/db.go index bc3fbc13d893..976bf2d632d6 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) || git.IsErrNotExist((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 }