mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Add merge style fast-forward-only
(#28954)
With this option, it is possible to require a linear commit history with the following benefits over the next best option `Rebase+fast-forward`: The original commits continue existing, with the original signatures continuing to stay valid instead of being rewritten, there is no merge commit, and reverting commits becomes easier. Closes #24906
This commit is contained in:
@@ -885,6 +885,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
|
||||
AllowRebase: true,
|
||||
AllowRebaseMerge: true,
|
||||
AllowSquash: true,
|
||||
AllowFastForwardOnly: true,
|
||||
AllowManualMerge: true,
|
||||
AutodetectManualMerge: false,
|
||||
AllowRebaseUpdate: true,
|
||||
@@ -911,6 +912,9 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
|
||||
if opts.AllowSquash != nil {
|
||||
config.AllowSquash = *opts.AllowSquash
|
||||
}
|
||||
if opts.AllowFastForwardOnly != nil {
|
||||
config.AllowFastForwardOnly = *opts.AllowFastForwardOnly
|
||||
}
|
||||
if opts.AllowManualMerge != nil {
|
||||
config.AllowManualMerge = *opts.AllowManualMerge
|
||||
}
|
||||
|
@@ -35,6 +35,7 @@ func TestRepoEdit(t *testing.T) {
|
||||
allowRebase := false
|
||||
allowRebaseMerge := false
|
||||
allowSquashMerge := false
|
||||
allowFastForwardOnlyMerge := false
|
||||
archived := true
|
||||
opts := api.EditRepoOption{
|
||||
Name: &ctx.Repo.Repository.Name,
|
||||
@@ -50,6 +51,7 @@ func TestRepoEdit(t *testing.T) {
|
||||
AllowRebase: &allowRebase,
|
||||
AllowRebaseMerge: &allowRebaseMerge,
|
||||
AllowSquash: &allowSquashMerge,
|
||||
AllowFastForwardOnly: &allowFastForwardOnlyMerge,
|
||||
Archived: &archived,
|
||||
}
|
||||
|
||||
|
@@ -1862,6 +1862,8 @@ func ViewIssue(ctx *context.Context) {
|
||||
mergeStyle = repo_model.MergeStyleRebaseMerge
|
||||
} else if prConfig.AllowSquash {
|
||||
mergeStyle = repo_model.MergeStyleSquash
|
||||
} else if prConfig.AllowFastForwardOnly {
|
||||
mergeStyle = repo_model.MergeStyleFastForwardOnly
|
||||
} else if prConfig.AllowManualMerge {
|
||||
mergeStyle = repo_model.MergeStyleManuallyMerged
|
||||
}
|
||||
|
@@ -576,6 +576,7 @@ func SettingsPost(ctx *context.Context) {
|
||||
AllowRebase: form.PullsAllowRebase,
|
||||
AllowRebaseMerge: form.PullsAllowRebaseMerge,
|
||||
AllowSquash: form.PullsAllowSquash,
|
||||
AllowFastForwardOnly: form.PullsAllowFastForwardOnly,
|
||||
AllowManualMerge: form.PullsAllowManualMerge,
|
||||
AutodetectManualMerge: form.EnableAutodetectManualMerge,
|
||||
AllowRebaseUpdate: form.PullsAllowRebaseUpdate,
|
||||
|
Reference in New Issue
Block a user