summaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/pull.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 6b643371e5..bca756aea1 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -639,6 +639,15 @@ func MergePullRequest(ctx *context.APIContext, form auth.MergePullRequestForm) {
}
}
+ if _, err := pull_service.IsSignedIfRequired(pr, ctx.User); err != nil {
+ if !models.IsErrWontSign(err) {
+ ctx.Error(http.StatusInternalServerError, "IsSignedIfRequired", err)
+ return
+ }
+ ctx.Error(http.StatusMethodNotAllowed, fmt.Sprintf("Protected branch %s requires signed commits but this merge would not be signed", pr.BaseBranch), err)
+ return
+ }
+
if len(form.Do) == 0 {
form.Do = string(models.MergeStyleMerge)
}