loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(api): refactor branch and tag existence checks (#30618)

- Update branch existence check to also include tag existence check
- Adjust error message for branch/tag existence check

ref: https://github.com/go-gitea/gitea/pull/30349

---------

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 6459c50278906893f3cbc2bf3e52eff65e739b37)

authored by

Bo-Yi Wu
wxiaoguang
Giteabot
and committed by
Earl Warren
4e2de8bd e64e8d24

+4 -5
+4 -5
routers/api/v1/repo/pull.go
··· 1079 1079 } 1080 1080 1081 1081 ctx.Repo.PullRequest.SameRepo = isSameRepo 1082 - log.Info("Base branch: %s", baseBranch) 1083 - log.Info("Repo path: %s", ctx.Repo.GitRepo.Path) 1082 + log.Trace("Repo path: %q, base branch: %q, head branch: %q", ctx.Repo.GitRepo.Path, baseBranch, headBranch) 1084 1083 // Check if base branch is valid. 1085 - if !ctx.Repo.GitRepo.IsBranchExist(baseBranch) { 1086 - ctx.NotFound("IsBranchExist") 1084 + if !ctx.Repo.GitRepo.IsBranchExist(baseBranch) && !ctx.Repo.GitRepo.IsTagExist(baseBranch) { 1085 + ctx.NotFound("BaseNotExist") 1087 1086 return nil, nil, nil, nil, "", "" 1088 1087 } 1089 1088 ··· 1146 1145 } 1147 1146 1148 1147 // Check if head branch is valid. 1149 - if !headGitRepo.IsBranchExist(headBranch) { 1148 + if !headGitRepo.IsBranchExist(headBranch) && !headGitRepo.IsTagExist(headBranch) { 1150 1149 headGitRepo.Close() 1151 1150 ctx.NotFound() 1152 1151 return nil, nil, nil, nil, "", ""