aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2022-12-29 20:40:20 +0800
committerGitHub <noreply@github.com>2022-12-29 14:40:20 +0200
commit47efba78ec966631ccdea3e05a50f4cf59ca9fd3 (patch)
tree65a8ef34d5c03ab40bc70111d04fe309546f09e8 /routers/web/repo
parenta35749893b91db48310d91ae0a32fee3ad3bb901 (diff)
downloadgitea-47efba78ec966631ccdea3e05a50f4cf59ca9fd3.tar.gz
gitea-47efba78ec966631ccdea3e05a50f4cf59ca9fd3.zip
Support template for merge message description (#22248)
Fix #21435. Use the first line of the template as the git commit message title, and the rest as the description. ## Snapshots <img width="806" alt="image" src="https://user-images.githubusercontent.com/9418365/209644083-5d85179c-cf58-404f-bc98-c662398a2411.png"> <img width="860" alt="image" src="https://user-images.githubusercontent.com/9418365/209644392-22573090-e2c1-458b-ba44-855b79735632.png"> <img width="1154" alt="image" src="https://user-images.githubusercontent.com/9418365/209644457-a1b2711a-6787-45b4-b52c-a88d7fc132d7.png"> Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'routers/web/repo')
-rw-r--r--routers/web/repo/issue.go6
-rw-r--r--routers/web/repo/pull.go2
2 files changed, 5 insertions, 3 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 79a8b2745a..100e343de4 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -1664,19 +1664,21 @@ func ViewIssue(ctx *context.Context) {
ctx.Data["MergeStyle"] = mergeStyle
- defaultMergeMessage, err := pull_service.GetDefaultMergeMessage(ctx, ctx.Repo.GitRepo, pull, mergeStyle)
+ defaultMergeMessage, defaultMergeBody, err := pull_service.GetDefaultMergeMessage(ctx, ctx.Repo.GitRepo, pull, mergeStyle)
if err != nil {
ctx.ServerError("GetDefaultMergeMessage", err)
return
}
ctx.Data["DefaultMergeMessage"] = defaultMergeMessage
+ ctx.Data["DefaultMergeBody"] = defaultMergeBody
- defaultSquashMergeMessage, err := pull_service.GetDefaultMergeMessage(ctx, ctx.Repo.GitRepo, pull, repo_model.MergeStyleSquash)
+ defaultSquashMergeMessage, defaultSquashMergeBody, err := pull_service.GetDefaultMergeMessage(ctx, ctx.Repo.GitRepo, pull, repo_model.MergeStyleSquash)
if err != nil {
ctx.ServerError("GetDefaultSquashMergeMessage", err)
return
}
ctx.Data["DefaultSquashMergeMessage"] = defaultSquashMergeMessage
+ ctx.Data["DefaultSquashMergeBody"] = defaultSquashMergeBody
if err = pull.LoadProtectedBranch(ctx); err != nil {
ctx.ServerError("LoadProtectedBranch", err)
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index 8929a183ee..a18f9f6a56 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -986,7 +986,7 @@ func MergePullRequest(ctx *context.Context) {
message := strings.TrimSpace(form.MergeTitleField)
if len(message) == 0 {
var err error
- message, err = pull_service.GetDefaultMergeMessage(ctx, ctx.Repo.GitRepo, pr, repo_model.MergeStyle(form.Do))
+ message, _, err = pull_service.GetDefaultMergeMessage(ctx, ctx.Repo.GitRepo, pr, repo_model.MergeStyle(form.Do))
if err != nil {
ctx.ServerError("GetDefaultMergeMessage", err)
return