aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShashvat Kedia <shashvat51@gmail.com>2020-01-28 13:59:30 +0530
committerzeripath <art27@cantab.net>2020-01-28 08:29:30 +0000
commita08175ac559267478c76dd2392067f8d4674cd19 (patch)
treeb1c8d00fd7bd979df406edf5a131f73b32dcb270
parente8860ef4f9fe84aac856e354a897734aac7c279b (diff)
downloadgitea-a08175ac559267478c76dd2392067f8d4674cd19.tar.gz
gitea-a08175ac559267478c76dd2392067f8d4674cd19.zip
Repo name added to automatically generated commit message when mergin… (#9997)
* Repo name added to automatically generated commit message when merging pull request * As per @lunny Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net>
-rw-r--r--models/pull.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/models/pull.go b/models/pull.go
index 1895030f75..8289c53cfe 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)