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.go19
1 files changed, 14 insertions, 5 deletions
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index a0b3567738..27b61309a5 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -950,13 +950,22 @@ func MergePullRequest(ctx *context.Context) {
return
}
- // set defaults to propagate needed fields
- if err := form.SetDefaults(ctx, pr); err != nil {
- ctx.ServerError("SetDefaults", fmt.Errorf("SetDefaults: %v", err))
- return
+ message := strings.TrimSpace(form.MergeTitleField)
+ if len(message) == 0 {
+ var err error
+ message, err = pull_service.GetDefaultMergeMessage(ctx.Repo.GitRepo, pr, repo_model.MergeStyle(form.Do))
+ if err != nil {
+ ctx.ServerError("GetDefaultMergeMessage", err)
+ return
+ }
+ }
+
+ form.MergeMessageField = strings.TrimSpace(form.MergeMessageField)
+ if len(form.MergeMessageField) > 0 {
+ message += "\n\n" + form.MergeMessageField
}
- if err := pull_service.Merge(pr, ctx.Doer, ctx.Repo.GitRepo, repo_model.MergeStyle(form.Do), form.HeadCommitID, form.MergeTitleField); err != nil {
+ if err := pull_service.Merge(ctx, pr, ctx.Doer, ctx.Repo.GitRepo, repo_model.MergeStyle(form.Do), form.HeadCommitID, message); err != nil {
if models.IsErrInvalidMergeStyle(err) {
ctx.Flash.Error(ctx.Tr("repo.pulls.invalid_merge_option"))
ctx.Redirect(issue.Link())