summaryrefslogtreecommitdiffstats
path: root/models/repo_unit.go
diff options
context:
space:
mode:
authorparnic <github@parnic.com>2021-03-27 09:55:40 -0500
committerGitHub <noreply@github.com>2021-03-27 15:55:40 +0100
commitf4d27498bdc615605e14f783501e1d1256cd8d22 (patch)
tree8d04695b060bd8bac65b4a0d669628fe220a23e6 /models/repo_unit.go
parent6b836ac5f7546bc9ffb118b213dba92d3dd9ba8e (diff)
downloadgitea-f4d27498bdc615605e14f783501e1d1256cd8d22.tar.gz
gitea-f4d27498bdc615605e14f783501e1d1256cd8d22.zip
Add DefaultMergeStyle option to repository (#14789)
Fixes #12293
Diffstat (limited to 'models/repo_unit.go')
-rw-r--r--models/repo_unit.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/repo_unit.go b/models/repo_unit.go
index 7702697ffa..1d54579a6e 100644
--- a/models/repo_unit.go
+++ b/models/repo_unit.go
@@ -102,6 +102,7 @@ type PullRequestsConfig struct {
AllowSquash bool
AllowManualMerge bool
AutodetectManualMerge bool
+ DefaultMergeStyle MergeStyle
}
// FromDB fills up a PullRequestsConfig from serialized format.
@@ -125,6 +126,15 @@ func (cfg *PullRequestsConfig) IsMergeStyleAllowed(mergeStyle MergeStyle) bool {
mergeStyle == MergeStyleManuallyMerged && cfg.AllowManualMerge
}
+// GetDefaultMergeStyle returns the default merge style for this pull request
+func (cfg *PullRequestsConfig) GetDefaultMergeStyle() MergeStyle {
+ if len(cfg.DefaultMergeStyle) != 0 {
+ return cfg.DefaultMergeStyle
+ }
+
+ return MergeStyleMerge
+}
+
// AllowedMergeStyleCount returns the total count of allowed merge styles for the PullRequestsConfig
func (cfg *PullRequestsConfig) AllowedMergeStyleCount() int {
count := 0