From 6e6e607a3b7e6554175fac8359cec2d57a914bf2 Mon Sep 17 00:00:00 2001 From: Markus Date: Sun, 25 Oct 2020 19:21:47 +0100 Subject: [PATCH 1/2] Deny wrong pull --- 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 e2cab70adc1e1..1420325ba5e27 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: No changes presented. ( Head is equal to Base )") + return + } + var ( repo = ctx.Repo.Repository labelIDs []int64 From 508d6f2d42c7304fa319ccb091961297ddfbda95 Mon Sep 17 00:00:00 2001 From: M4RKUS-11111 <73301416+M4RKUS-11111@users.noreply.github.com> Date: Mon, 26 Oct 2020 08:28:49 +0100 Subject: [PATCH 2/2] Update routers/api/v1/repo/pull.go Co-authored-by: zeripath --- routers/api/v1/repo/pull.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index 1420325ba5e27..b2b71180a481e 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -286,7 +286,7 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption if form.Head == form.Base { ctx.Error(http.StatusUnprocessableEntity, "BaseHeadSame", - "Invalid PullRequest: No changes presented. ( Head is equal to Base )") + "Invalid PullRequest: There are no changes between the head and the base") return }