aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/compare.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/repo/compare.go')
-rw-r--r--routers/web/repo/compare.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go
index 8b99dd95da..c771b30e5f 100644
--- a/routers/web/repo/compare.go
+++ b/routers/web/repo/compare.go
@@ -575,7 +575,13 @@ func PrepareCompareDiff(
ctx.Data["CommitRepoLink"] = ci.HeadRepo.Link()
ctx.Data["AfterCommitID"] = headCommitID
- ctx.Data["ExpandNewPrForm"] = ctx.FormBool("expand")
+
+ // follow GitHub's behavior: autofill the form and expand
+ newPrFormTitle := ctx.FormTrim("title")
+ newPrFormBody := ctx.FormTrim("body")
+ ctx.Data["ExpandNewPrForm"] = ctx.FormBool("expand") || ctx.FormBool("quick_pull") || newPrFormTitle != "" || newPrFormBody != ""
+ ctx.Data["TitleQuery"] = newPrFormTitle
+ ctx.Data["BodyQuery"] = newPrFormBody
if (headCommitID == ci.CompareInfo.MergeBase && !ci.DirectComparison) ||
headCommitID == ci.CompareInfo.BaseCommitID {
@@ -608,7 +614,7 @@ func PrepareCompareDiff(
fileOnly := ctx.FormBool("file-only")
- diff, err := gitdiff.GetDiffForRender(ctx, ci.HeadGitRepo,
+ diff, err := gitdiff.GetDiffForRender(ctx, ci.HeadRepo.Link(), ci.HeadGitRepo,
&gitdiff.DiffOptions{
BeforeCommitID: beforeCommitID,
AfterCommitID: headCommitID,