diff options
author | ttys3 <41882455+ttys3@users.noreply.github.com> | 2022-06-03 11:45:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-02 23:45:54 -0400 |
commit | 0c759fd4dee1c2a82ecdb0a6019d8ee78dae2209 (patch) | |
tree | 54ceb9a1bf1e750188f8cce9380e0f6a7898217e /models | |
parent | 808a7803098bd86c83185cb823c5b0e2a5b2c56d (diff) | |
download | gitea-0c759fd4dee1c2a82ecdb0a6019d8ee78dae2209.tar.gz gitea-0c759fd4dee1c2a82ecdb0a6019d8ee78dae2209.zip |
feat: add DEFAULT_MERGE_STYLE to `repository.pull-request` section for repo init (#19751)
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 2 | ||||
-rw-r--r-- | models/repo/repo_unit.go | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/models/repo.go b/models/repo.go index d2ad560948..bf70295275 100644 --- a/models/repo.go +++ b/models/repo.go @@ -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{ diff --git a/models/repo/repo_unit.go b/models/repo/repo_unit.go index a73678c6ef..8c17d6138c 100644 --- a/models/repo/repo_unit.go +++ b/models/repo/repo_unit.go @@ -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 } |