From ff1b00002a17f20219d79eece6b719f893c5f4c4 Mon Sep 17 00:00:00 2001 From: M4RKUS-11111 <73301416+M4RKUS-11111@users.noreply.github.com> Date: Mon, 26 Oct 2020 10:05:27 +0100 Subject: 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 --- 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 -- cgit v1.2.3