1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Fix incorrect TagName/BranchName usages (#33279)

Add add a new test
This commit is contained in:
wxiaoguang
2025-01-15 17:34:55 +08:00
committed by GitHub
parent fcd096231a
commit f6dbf0e7b3
6 changed files with 21 additions and 16 deletions

View File

@@ -56,7 +56,6 @@ type Repository struct {
// RefFullName is the full ref name that the user is viewing
RefFullName git.RefName
BranchName string // it is the RefFullName's short name if its type is "branch"
TagName string // it is the RefFullName's short name if its type is "tag"
TreePath string
// Commit it is always set to the commit for the branch or tag, or just the commit that the user is viewing
@@ -851,7 +850,6 @@ func RepoRefByType(detectRefType git.RefType) func(*Context) {
ctx.Repo.CommitID = ctx.Repo.Commit.ID.String()
} else if refType == git.RefTypeTag && ctx.Repo.GitRepo.IsTagExist(refShortName) {
ctx.Repo.RefFullName = git.RefNameFromTag(refShortName)
ctx.Repo.TagName = refShortName
ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetTagCommit(refShortName)
if err != nil {
@@ -901,8 +899,6 @@ func RepoRefByType(detectRefType git.RefType) func(*Context) {
ctx.Data["BranchName"] = ctx.Repo.BranchName
ctx.Data["TagName"] = ctx.Repo.TagName
ctx.Data["CommitID"] = ctx.Repo.CommitID
ctx.Data["CanCreateBranch"] = ctx.Repo.CanCreateBranch() // only used by the branch selector dropdown: AllowCreateNewRef