summaryrefslogtreecommitdiffstats
path: root/routers/web/repo/pull.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/repo/pull.go')
-rw-r--r--routers/web/repo/pull.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index 703bbd837a..565c645801 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -427,10 +427,18 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
}
defer headGitRepo.Close()
- headBranchExist = headGitRepo.IsBranchExist(pull.HeadBranch)
+ if pull.Flow == models.PullRequestFlowGithub {
+ headBranchExist = headGitRepo.IsBranchExist(pull.HeadBranch)
+ } else {
+ headBranchExist = git.IsReferenceExist(baseGitRepo.Path, pull.GetGitRefName())
+ }
if headBranchExist {
- headBranchSha, err = headGitRepo.GetBranchCommitID(pull.HeadBranch)
+ if pull.Flow != models.PullRequestFlowGithub {
+ headBranchSha, err = baseGitRepo.GetRefCommitID(pull.GetGitRefName())
+ } else {
+ headBranchSha, err = headGitRepo.GetBranchCommitID(pull.HeadBranch)
+ }
if err != nil {
ctx.ServerError("GetBranchCommitID", err)
return nil