mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Add force_merge to merge request and fix checking mergable (#23010)
Fix #23000.
This commit is contained in:
@@ -926,11 +926,19 @@ func MergePullRequest(ctx *context.Context) {
|
||||
pr := issue.PullRequest
|
||||
pr.Issue = issue
|
||||
pr.Issue.Repo = ctx.Repo.Repository
|
||||
manualMerge := repo_model.MergeStyle(form.Do) == repo_model.MergeStyleManuallyMerged
|
||||
forceMerge := form.ForceMerge != nil && *form.ForceMerge
|
||||
|
||||
manuallyMerged := repo_model.MergeStyle(form.Do) == repo_model.MergeStyleManuallyMerged
|
||||
|
||||
mergeCheckType := pull_service.MergeCheckTypeGeneral
|
||||
if form.MergeWhenChecksSucceed {
|
||||
mergeCheckType = pull_service.MergeCheckTypeAuto
|
||||
}
|
||||
if manuallyMerged {
|
||||
mergeCheckType = pull_service.MergeCheckTypeManually
|
||||
}
|
||||
|
||||
// start with merging by checking
|
||||
if err := pull_service.CheckPullMergable(ctx, ctx.Doer, &ctx.Repo.Permission, pr, manualMerge, forceMerge); err != nil {
|
||||
if err := pull_service.CheckPullMergable(ctx, ctx.Doer, &ctx.Repo.Permission, pr, mergeCheckType, form.ForceMerge); err != nil {
|
||||
switch {
|
||||
case errors.Is(err, pull_service.ErrIsClosed):
|
||||
if issue.IsPull {
|
||||
@@ -962,7 +970,7 @@ func MergePullRequest(ctx *context.Context) {
|
||||
}
|
||||
|
||||
// handle manually-merged mark
|
||||
if manualMerge {
|
||||
if manuallyMerged {
|
||||
if err := pull_service.MergedManually(pr, ctx.Doer, ctx.Repo.GitRepo, form.MergeCommitID); err != nil {
|
||||
switch {
|
||||
|
||||
|
Reference in New Issue
Block a user