diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini index c17e2cacb..c30d44545 100644 --- a/conf/locale/locale_en-US.ini +++ b/conf/locale/locale_en-US.ini @@ -640,6 +640,7 @@ pulls.cannot_auto_merge_desc = This pull request can't be merged automatically b pulls.cannot_auto_merge_helper = Please merge manually in order to resolve the conflicts. pulls.create_merge_commit = Create a merge commit pulls.rebase_before_merging = Rebase before merging +pulls.commit_description = Commit Description pulls.merge_pull_request = Merge Pull Request pulls.open_unmerged_pull_exists = `You can't perform reopen operation because there is already an open pull request (#%d) from same repository with same merge information and is waiting for merging.` pulls.delete_branch = Delete Branch diff --git a/models/pull.go b/models/pull.go index 43211ed72..1d54d082e 100644 --- a/models/pull.go +++ b/models/pull.go @@ -193,7 +193,7 @@ const ( // Merge merges pull request to base repository. // FIXME: add repoWorkingPull make sure two merges does not happen at same time. -func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle MergeStyle) (err error) { +func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle MergeStyle, CommitDescription string) (err error) { defer func() { go HookQueue.Add(pr.BaseRepo.ID) go AddTestPullRequestTask(doer, pr.BaseRepo.ID, pr.BaseBranch, false) @@ -266,7 +266,8 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle if _, stderr, err = process.ExecDir(-1, tmpBasePath, fmt.Sprintf("PullRequest.Merge (git merge): %s", tmpBasePath), "git", "commit", fmt.Sprintf("--author='%s <%s>'", sig.Name, sig.Email), - "-m", fmt.Sprintf("Merge branch '%s' of %s/%s into %s", pr.HeadBranch, pr.HeadUserName, pr.HeadRepo.Name, pr.BaseBranch)); err != nil { + "-m", fmt.Sprintf("Merge branch '%s' of %s/%s into %s", pr.HeadBranch, pr.HeadUserName, pr.HeadRepo.Name, pr.BaseBranch), + "-m", CommitDescription); err != nil { return fmt.Errorf("git commit [%s]: %v - %s", tmpBasePath, err, stderr) } diff --git a/routes/repo/pull.go b/routes/repo/pull.go index 049cf3686..58f0a49ac 100644 --- a/routes/repo/pull.go +++ b/routes/repo/pull.go @@ -406,7 +406,7 @@ func MergePullRequest(c *context.Context) { pr.Issue = issue pr.Issue.Repo = c.Repo.Repository - if err = pr.Merge(c.User, c.Repo.GitRepo, models.MergeStyle(c.Query("merge_style"))); err != nil { + if err = pr.Merge(c.User, c.Repo.GitRepo, models.MergeStyle(c.Query("merge_style")), c.Query("commit_description")); err != nil { c.ServerError("Merge", err) return } diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index c03b6973b..1d4999857 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -195,6 +195,12 @@