1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-05 01:45:22 +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:
Earl Warren 2025-06-28 20:27:41 +02:00
parent b8e66a5552
commit 66e0988a43
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -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 {