aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorM4RKUS-111112020-10-27 19:35:28 +0100
committerGitHub2020-10-27 18:35:28 +0000
commit732f22ad7de0b4a5d5e6fa259c4d93dfe88ba346 (patch)
treea0b1c004114faf58e1bba374d49054c05b72a9d7
parentc9e6069970ff23757918fb431c11e2ebd122c0e3 (diff)
Deny wrong pull (#13308) (#13327)
* Deny wrong pull * Update routers/api/v1/repo/pull.go Co-authored-by: Markus <git+markus@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
-rw-r--r--routers/api/v1/repo/pull.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 8425aa612..ba5904424 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -201,6 +201,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