mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-24 13:43:43 +09:00
fix(pulls): add branch-name option for DEFAULT_TITLE_SOURCE (#38356)
Adds a new `branch-name` value for the `[repository.pull-request]` `DEFAULT_TITLE_SOURCE` setting that always uses the normalized branch name as the PR title, regardless of commit count. Fix #38317 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -383,7 +383,9 @@ func autoTitleFromBranchName(name string) string {
|
||||
|
||||
func prepareNewPullRequestTitleContent(ci *git_service.CompareInfo, commits []*git_model.SignCommitWithStatuses, defaultTitleSource string) (title, content string) {
|
||||
useFirstCommitAsTitle := len(commits) == 1 || (defaultTitleSource == setting.RepoPRTitleSourceFirstCommit && len(commits) > 0)
|
||||
if useFirstCommitAsTitle {
|
||||
if defaultTitleSource == setting.RepoPRTitleSourceBranchName {
|
||||
title = ci.HeadRef.ShortName()
|
||||
} else if useFirstCommitAsTitle {
|
||||
// the "commits" are from "ShowPrettyFormatLogToList", which is ordered from newest to oldest, here take the oldest one
|
||||
c := commits[len(commits)-1]
|
||||
title = c.UserCommit.GitCommit.MessageTitle()
|
||||
|
||||
Reference in New Issue
Block a user