diff options
author | parnic <github@parnic.com> | 2021-03-27 09:55:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-27 15:55:40 +0100 |
commit | f4d27498bdc615605e14f783501e1d1256cd8d22 (patch) | |
tree | 8d04695b060bd8bac65b4a0d669628fe220a23e6 /modules | |
parent | 6b836ac5f7546bc9ffb118b213dba92d3dd9ba8e (diff) | |
download | gitea-f4d27498bdc615605e14f783501e1d1256cd8d22.tar.gz gitea-f4d27498bdc615605e14f783501e1d1256cd8d22.zip |
Add DefaultMergeStyle option to repository (#14789)
Fixes #12293
Diffstat (limited to 'modules')
-rw-r--r-- | modules/convert/repository.go | 3 | ||||
-rw-r--r-- | modules/forms/repo_form.go | 1 | ||||
-rw-r--r-- | modules/structs/repo.go | 3 |
3 files changed, 7 insertions, 0 deletions
diff --git a/modules/convert/repository.go b/modules/convert/repository.go index 813201ca68..63a22bb04e 100644 --- a/modules/convert/repository.go +++ b/modules/convert/repository.go @@ -71,6 +71,7 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool) allowRebase := false allowRebaseMerge := false allowSquash := false + defaultMergeStyle := models.MergeStyleMerge if unit, err := repo.GetUnit(models.UnitTypePullRequests); err == nil { config := unit.PullRequestsConfig() hasPullRequests = true @@ -79,6 +80,7 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool) allowRebase = config.AllowRebase allowRebaseMerge = config.AllowRebaseMerge allowSquash = config.AllowSquash + defaultMergeStyle = config.GetDefaultMergeStyle() } hasProjects := false if _, err := repo.GetUnit(models.UnitTypeProjects); err == nil { @@ -139,6 +141,7 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool) AllowRebase: allowRebase, AllowRebaseMerge: allowRebaseMerge, AllowSquash: allowSquash, + DefaultMergeStyle: string(defaultMergeStyle), AvatarURL: repo.AvatarLink(), Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate, MirrorInterval: mirrorInterval, diff --git a/modules/forms/repo_form.go b/modules/forms/repo_form.go index 6c7c9bea13..d9eb06d194 100644 --- a/modules/forms/repo_form.go +++ b/modules/forms/repo_form.go @@ -140,6 +140,7 @@ type RepoSettingForm struct { PullsAllowRebaseMerge bool PullsAllowSquash bool PullsAllowManualMerge bool + PullsDefaultMergeStyle string EnableAutodetectManualMerge bool EnableTimetracker bool AllowOnlyContributorsToTrackTime bool diff --git a/modules/structs/repo.go b/modules/structs/repo.go index c47700cd00..c23bd1033f 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -89,6 +89,7 @@ type Repository struct { AllowRebase bool `json:"allow_rebase"` AllowRebaseMerge bool `json:"allow_rebase_explicit"` AllowSquash bool `json:"allow_squash_merge"` + DefaultMergeStyle string `json:"default_merge_style"` AvatarURL string `json:"avatar_url"` Internal bool `json:"internal"` MirrorInterval string `json:"mirror_interval"` @@ -171,6 +172,8 @@ type EditRepoOption struct { AllowManualMerge *bool `json:"allow_manual_merge,omitempty"` // either `true` to enable AutodetectManualMerge, or `false` to prevent it. `has_pull_requests` must be `true`, Note: In some special cases, misjudgments can occur. AutodetectManualMerge *bool `json:"autodetect_manual_merge,omitempty"` + // set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", or "squash". `has_pull_requests` must be `true`. + DefaultMergeStyle *string `json:"default_merge_style,omitempty"` // set to `true` to archive this repository. Archived *bool `json:"archived,omitempty"` // set to a string like `8h30m0s` to set the mirror interval time |