mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 06:24:11 +01:00 
			
		
		
		
	* Fixes #7238 - Annotated tag commit ID incorrect * Fixes #7238 - Annotated tag commit ID incorrect
This commit is contained in:
		
							parent
							
								
									7bd0dc4975
								
							
						
					
					
						commit
						567e117df8
					
				@ -141,12 +141,13 @@ func (repo *Repository) GetTagNameBySHA(sha string) (string, error) {
 | 
			
		||||
			fields := strings.Fields(tagRef)
 | 
			
		||||
			if strings.HasPrefix(fields[0], sha) && strings.HasPrefix(fields[1], TagPrefix) {
 | 
			
		||||
				name := fields[1][len(TagPrefix):]
 | 
			
		||||
				// annotated tags show up twice, their name for commit ID is suffixed with ^{}
 | 
			
		||||
				name = strings.TrimSuffix(name, "^{}")
 | 
			
		||||
				// annotated tags show up twice, we should only return if is not the ^{} ref
 | 
			
		||||
				if !strings.HasSuffix(name, "^{}") {
 | 
			
		||||
					return name, nil
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return "", ErrNotExist{ID: sha}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -281,7 +281,7 @@ func ToCommitUser(sig *git.Signature) *api.CommitUser {
 | 
			
		||||
// ToCommitMeta convert a git.Tag to an api.CommitMeta
 | 
			
		||||
func ToCommitMeta(repo *models.Repository, tag *git.Tag) *api.CommitMeta {
 | 
			
		||||
	return &api.CommitMeta{
 | 
			
		||||
		SHA: tag.ID.String(),
 | 
			
		||||
		SHA: tag.Object.String(),
 | 
			
		||||
		// TODO: Add the /commits API endpoint and use it here (https://developer.github.com/v3/repos/commits/#get-a-single-commit)
 | 
			
		||||
		URL: util.URLJoin(repo.APIURL(), "git/commits", tag.ID.String()),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user