Prevent Stats Indexer reporting error if repo dir missing (#18870)

Repositories missing their directory should not report an error from the stats
indexer.

Close #18847

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
tokarchuk/v1.17
zeripath 3 years ago committed by GitHub
parent 2f2f11e45d
commit f1c6cf7c51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      modules/indexer/stats/db.go

@ -37,6 +37,9 @@ func (db *DBIndexer) Index(id int64) error {
gitRepo, err := git.OpenRepositoryCtx(ctx, repo.RepoPath()) gitRepo, err := git.OpenRepositoryCtx(ctx, repo.RepoPath())
if err != nil { if err != nil {
if err.Error() == "no such file or directory" {
return nil
}
return err return err
} }
defer gitRepo.Close() defer gitRepo.Close()

Loading…
Cancel
Save