Skip to content

Commit f719ffc

Browse files
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 <[email protected]> * as per lunny Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent df416f2 commit f719ffc

File tree

1 file changed

+5
-1
lines changed
  • modules/indexer/stats

1 file changed

+5
-1
lines changed

modules/indexer/stats/db.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ func (db *DBIndexer) Index(id int64) error {
3838
// Get latest commit for default branch
3939
commitID, err := gitRepo.GetBranchCommitID(repo.DefaultBranch)
4040
if err != nil {
41-
log.Error("Unable to get commit ID for defaultbranch %s in %s", repo.DefaultBranch, repo.RepoPath())
41+
if git.IsErrBranchNotExist(err) {
42+
log.Debug("Unable to get commit ID for defaultbranch %s in %s ... skipping this repository", repo.DefaultBranch, repo.RepoPath())
43+
return nil
44+
}
45+
log.Error("Unable to get commit ID for defaultbranch %s in %s. Error: %v", repo.DefaultBranch, repo.RepoPath(), err)
4246
return err
4347
}
4448

0 commit comments

Comments
 (0)