From 47cb9b3de2ee3ca54351b4cf1a04913a36e3587f Mon Sep 17 00:00:00 2001 From: M4RKUS-11111 <73301416+M4RKUS-11111@users.noreply.github.com> Date: Tue, 27 Oct 2020 21:26:07 +0100 Subject: [PATCH] Deny wrong pull (#13308) (#13326) * Deny wrong pull (#13308) * Deny wrong pull * Update routers/api/v1/repo/pull.go Co-authored-by: zeripath Co-authored-by: Markus Co-authored-by: zeripath * CI.restart() Co-authored-by: Markus Co-authored-by: zeripath Co-authored-by: 6543 <6543@obermui.de> --- routers/api/v1/repo/pull.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index e2cab70adc..b2b71180a4 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -284,6 +284,12 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption // "422": // "$ref": "#/responses/validationError" + if form.Head == form.Base { + ctx.Error(http.StatusUnprocessableEntity, "BaseHeadSame", + "Invalid PullRequest: There are no changes between the head and the base") + return + } + var ( repo = ctx.Repo.Repository labelIDs []int64