diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index a9507332f8..c9a2bb4e08 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -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 { diff --git a/services/automerge/automerge.go b/services/automerge/automerge.go index 96a0e0498d..0cdc113379 100644 --- a/services/automerge/automerge.go +++ b/services/automerge/automerge.go @@ -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