mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-05 09:55:20 +02:00
feat: make API pull and compare endpoint references to head more robust
It is best to prefix the reference to resolve any ambiguity once it has been determined that it is a branch or a tag. It was done in forgejo/forgejo#5991 for the base reference but not for the head reference. Refs forgejo/forgejo#5991
This commit is contained in:
parent
b8e66a5552
commit
66e0988a43
1 changed files with 5 additions and 0 deletions
|
@ -1202,6 +1202,11 @@ func parseCompareInfo(ctx *context.APIContext, form api.CreatePullRequestOption)
|
|||
}
|
||||
|
||||
headBranchRef := headBranch
|
||||
if headIsBranch {
|
||||
headBranchRef = git.BranchPrefix + headBranch
|
||||
} else if headIsTag {
|
||||
headBranchRef = git.TagPrefix + headBranch
|
||||
}
|
||||
|
||||
compareInfo, err := headGitRepo.GetCompareInfo(repo_model.RepoPath(baseRepo.Owner.Name, baseRepo.Name), baseBranchRef, headBranchRef, false, false)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue