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

Fix incorrect ref usages (#33301)

Fix #33297

By the way, improve some locales
This commit is contained in:
wxiaoguang
2025-01-16 21:52:21 +08:00
committed by GitHub
parent ab347fd0f7
commit cfc6e21f06
6 changed files with 24 additions and 22 deletions

View File

@@ -777,6 +777,18 @@ func repoRefFullName(typ git.RefType, shortName string) git.RefName {
}
}
func RepoRefByDefaultBranch() func(*Context) {
return func(ctx *Context) {
ctx.Repo.RefFullName = git.RefNameFromBranch(ctx.Repo.Repository.DefaultBranch)
ctx.Repo.BranchName = ctx.Repo.Repository.DefaultBranch
ctx.Repo.Commit, _ = ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.BranchName)
ctx.Repo.CommitsCount, _ = ctx.Repo.GetCommitsCount()
ctx.Data["RefFullName"] = ctx.Repo.RefFullName
ctx.Data["BranchName"] = ctx.Repo.BranchName
ctx.Data["CommitsCount"] = ctx.Repo.CommitsCount
}
}
// RepoRefByType handles repository reference name for a specific type
// of repository reference
func RepoRefByType(detectRefType git.RefType) func(*Context) {