parent
6b836ac5f7
commit
f4d27498bd
11 changed files with 70 additions and 2 deletions
|
@ -1086,7 +1086,7 @@ func CreateRepository(ctx DBContext, doer, u *User, repo *Repository, overwriteO
|
|||
units = append(units, RepoUnit{
|
||||
RepoID: repo.ID,
|
||||
Type: tp,
|
||||
Config: &PullRequestsConfig{AllowMerge: true, AllowRebase: true, AllowRebaseMerge: true, AllowSquash: true},
|
||||
Config: &PullRequestsConfig{AllowMerge: true, AllowRebase: true, AllowRebaseMerge: true, AllowSquash: true, DefaultMergeStyle: MergeStyleMerge},
|
||||
})
|
||||
} else {
|
||||
units = append(units, RepoUnit{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue