Skip to content

Commit

Permalink
If the default branch is not present do not report error on stats ind…
Browse files Browse the repository at this point in the history
…exing (follow-up of #15546) (#15583)

#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 <[email protected]>
  • Loading branch information
zeripath authored Apr 22, 2021
1 parent 72e0ad8 commit d6a33ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/indexer/stats/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d6a33ce

Please sign in to comment.