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>
This commit is contained in:
zeripath 2022-02-25 04:22:09 +00:00 committed by GitHub
parent 2f2f11e45d
commit f1c6cf7c51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

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