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 <art27@cantab.net> * as per lunny Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
		
							parent
							
								
									df416f2414
								
							
						
					
					
						commit
						f719ffc783
					
				| @ -38,7 +38,11 @@ func (db *DBIndexer) Index(id int64) error { | |||||||
| 	// Get latest commit for default branch
 | 	// Get latest commit for default branch
 | ||||||
| 	commitID, err := gitRepo.GetBranchCommitID(repo.DefaultBranch) | 	commitID, err := gitRepo.GetBranchCommitID(repo.DefaultBranch) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		log.Error("Unable to get commit ID for defaultbranch %s in %s", repo.DefaultBranch, repo.RepoPath()) | 		if git.IsErrBranchNotExist(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 | 		return err | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user