mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-23 11:01:49 +01:00
feat: add DEFAULT_MERGE_STYLE to repository.pull-request
section for repo init (#19751)
This commit is contained in:
parent
808a780309
commit
0c759fd4de
6 changed files with 15 additions and 1 deletions
|
@ -948,6 +948,9 @@ PATH =
|
|||
;; List of keywords used in Pull Request comments to automatically reopen a related issue
|
||||
;REOPEN_KEYWORDS = reopen,reopens,reopened
|
||||
;;
|
||||
;; Set default merge style for repository creating, valid options: merge, rebase, rebase-merge, squash
|
||||
;DEFAULT_MERGE_STYLE = merge
|
||||
;;
|
||||
;; In the default merge message for squash commits include at most this many commits
|
||||
;DEFAULT_MERGE_MESSAGE_COMMITS_LIMIT = 50
|
||||
;;
|
||||
|
|
|
@ -92,6 +92,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
|||
keywords used in Pull Request comments to automatically close a related issue
|
||||
- `REOPEN_KEYWORDS`: **reopen**, **reopens**, **reopened**: List of keywords used in Pull Request comments to automatically reopen
|
||||
a related issue
|
||||
- `DEFAULT_MERGE_STYLE`: **merge**: Set default merge style for repository creating, valid options: `merge`, `rebase`, `rebase-merge`, `squash`
|
||||
- `DEFAULT_MERGE_MESSAGE_COMMITS_LIMIT`: **50**: In the default merge message for squash commits include at most this many commits. Set to `-1` to include all commits
|
||||
- `DEFAULT_MERGE_MESSAGE_SIZE`: **5120**: In the default merge message for squash commits limit the size of the commit messages. Set to `-1` to have no limit. Only used if `POPULATE_SQUASH_COMMENT_WITH_COMMIT_MESSAGES` is `true`.
|
||||
- `DEFAULT_MERGE_MESSAGE_ALL_AUTHORS`: **false**: In the default merge message for squash commits walk all commits to include all authors in the Co-authored-by otherwise just use those in the limited list
|
||||
|
|
|
@ -373,7 +373,7 @@ func CreateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_
|
|||
units = append(units, repo_model.RepoUnit{
|
||||
RepoID: repo.ID,
|
||||
Type: tp,
|
||||
Config: &repo_model.PullRequestsConfig{AllowMerge: true, AllowRebase: true, AllowRebaseMerge: true, AllowSquash: true, DefaultMergeStyle: repo_model.MergeStyleMerge, AllowRebaseUpdate: true},
|
||||
Config: &repo_model.PullRequestsConfig{AllowMerge: true, AllowRebase: true, AllowRebaseMerge: true, AllowSquash: true, DefaultMergeStyle: repo_model.MergeStyle(setting.Repository.PullRequest.DefaultMergeStyle), AllowRebaseUpdate: true},
|
||||
})
|
||||
} else {
|
||||
units = append(units, repo_model.RepoUnit{
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/unit"
|
||||
"code.gitea.io/gitea/modules/json"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
|
@ -148,6 +149,10 @@ func (cfg *PullRequestsConfig) GetDefaultMergeStyle() MergeStyle {
|
|||
return cfg.DefaultMergeStyle
|
||||
}
|
||||
|
||||
if setting.Repository.PullRequest.DefaultMergeStyle != "" {
|
||||
return MergeStyle(setting.Repository.PullRequest.DefaultMergeStyle)
|
||||
}
|
||||
|
||||
return MergeStyleMerge
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ var (
|
|||
WorkInProgressPrefixes []string
|
||||
CloseKeywords []string
|
||||
ReopenKeywords []string
|
||||
DefaultMergeStyle string
|
||||
DefaultMergeMessageCommitsLimit int
|
||||
DefaultMergeMessageSize int
|
||||
DefaultMergeMessageAllAuthors bool
|
||||
|
@ -192,6 +193,7 @@ var (
|
|||
WorkInProgressPrefixes []string
|
||||
CloseKeywords []string
|
||||
ReopenKeywords []string
|
||||
DefaultMergeStyle string
|
||||
DefaultMergeMessageCommitsLimit int
|
||||
DefaultMergeMessageSize int
|
||||
DefaultMergeMessageAllAuthors bool
|
||||
|
@ -205,6 +207,7 @@ var (
|
|||
// https://help.github.com/articles/closing-issues-via-commit-messages
|
||||
CloseKeywords: strings.Split("close,closes,closed,fix,fixes,fixed,resolve,resolves,resolved", ","),
|
||||
ReopenKeywords: strings.Split("reopen,reopens,reopened", ","),
|
||||
DefaultMergeStyle: "merge",
|
||||
DefaultMergeMessageCommitsLimit: 50,
|
||||
DefaultMergeMessageSize: 5 * 1024,
|
||||
DefaultMergeMessageAllAuthors: false,
|
||||
|
|
|
@ -456,6 +456,8 @@ func SubmitInstall(ctx *context.Context) {
|
|||
cfg.Section("log").Key("ROOT_PATH").SetValue(form.LogRootPath)
|
||||
cfg.Section("log").Key("ROUTER").SetValue("console")
|
||||
|
||||
cfg.Section("repository.pull-request").Key("DEFAULT_MERGE_STYLE").SetValue("merge")
|
||||
|
||||
cfg.Section("repository.signing").Key("DEFAULT_TRUST_MODEL").SetValue("committer")
|
||||
|
||||
cfg.Section("security").Key("INSTALL_LOCK").SetValue("true")
|
||||
|
|
Loading…
Reference in a new issue