mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Convert plumbing.ErrObjectNotFound to git.ErrNotExist in getCommit (#10862)
Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
This commit is contained in:
		@@ -94,9 +94,15 @@ func (repo *Repository) getCommit(id SHA1) (*Commit, error) {
 | 
			
		||||
	gogitCommit, err := repo.gogitRepo.CommitObject(id)
 | 
			
		||||
	if err == plumbing.ErrObjectNotFound {
 | 
			
		||||
		tagObject, err = repo.gogitRepo.TagObject(id)
 | 
			
		||||
		if err == plumbing.ErrObjectNotFound {
 | 
			
		||||
			return nil, ErrNotExist{
 | 
			
		||||
				ID: id.String(),
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if err == nil {
 | 
			
		||||
			gogitCommit, err = repo.gogitRepo.CommitObject(tagObject.Target)
 | 
			
		||||
		}
 | 
			
		||||
		// if we get a plumbing.ErrObjectNotFound here then the repository is broken and it should be 500
 | 
			
		||||
	}
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user