fix: check PR reference on base repository (#8431)

- Regression of forgejo/forgejo#8425 (I was fooled by the github flow being `headGitRepo`).

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8431
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
Gusted 2025-07-06 14:23:47 +02:00 committed by Earl Warren
parent 466e7bfcb8
commit ff5ef8fe8b
2 changed files with 2 additions and 2 deletions

View file

@ -638,7 +638,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
if pull.Flow == issues_model.PullRequestFlowGithub {
headBranchExist = headGitRepo.IsBranchExist(pull.HeadBranch)
} else {
headBranchExist = headGitRepo.IsReferenceExist(pull.GetGitRefName())
headBranchExist = baseGitRepo.IsReferenceExist(pull.GetGitRefName())
}
if headBranchExist {

View file

@ -162,7 +162,7 @@ func handlePullRequestAutoMerge(pullID int64, sha string) {
return
}
case issues_model.PullRequestFlowAGit:
headBranchExist := headGitRepo.IsReferenceExist(pr.GetGitRefName())
headBranchExist := baseGitRepo.IsReferenceExist(pr.GetGitRefName())
if !headBranchExist {
log.Warn("Head branch of auto merge %-v does not exist [HeadRepoID: %d, Branch(Agit): %s]", pr, pr.HeadRepoID, pr.HeadBranch)
return