From a08175ac559267478c76dd2392067f8d4674cd19 Mon Sep 17 00:00:00 2001 From: Shashvat Kedia Date: Tue, 28 Jan 2020 13:59:30 +0530 Subject: [PATCH] =?UTF-8?q?Repo=20name=20added=20to=20automatically=20gene?= =?UTF-8?q?rated=20commit=20message=20when=20mergin=E2=80=A6=20(#9997)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Repo name added to automatically generated commit message when merging pull request * As per @lunny Co-authored-by: Lauris BH Co-authored-by: zeripath --- models/pull.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/models/pull.go b/models/pull.go index 1895030f7..8289c53cf 100644 --- a/models/pull.go +++ b/models/pull.go @@ -185,7 +185,12 @@ func (pr *PullRequest) GetDefaultMergeMessage() string { log.Error("Cannot load issue %d for PR id %d: Error: %v", pr.IssueID, pr.ID, err) return "" } - return fmt.Sprintf("Merge pull request '%s' (#%d) from %s/%s into %s", pr.Issue.Title, pr.Issue.Index, pr.MustHeadUserName(), pr.HeadBranch, pr.BaseBranch) + + if pr.BaseRepoID == pr.HeadRepoID { + return fmt.Sprintf("Merge pull request '%s' (#%d) from %s into %s", pr.Issue.Title, pr.Issue.Index, pr.HeadBranch, pr.BaseBranch) + } + + return fmt.Sprintf("Merge pull request '%s' (#%d) from %s:%s into %s", pr.Issue.Title, pr.Issue.Index, pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseBranch) } // GetCommitMessages returns the commit messages between head and merge base (if there is one)