summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM4RKUS-11111 <73301416+M4RKUS-11111@users.noreply.github.com>2020-10-26 10:05:27 +0100
committerGitHub <noreply@github.com>2020-10-26 11:05:27 +0200
commitff1b00002a17f20219d79eece6b719f893c5f4c4 (patch)
treef8b583dcc361f2c6e2d72c10ddcd41918fed707c
parentc40df54e28fe1a1cfd0fc5f834451996d96028f3 (diff)
downloadgitea-ff1b00002a17f20219d79eece6b719f893c5f4c4.tar.gz
gitea-ff1b00002a17f20219d79eece6b719f893c5f4c4.zip
Deny wrong pull (#13308)
* Deny wrong pull * Update routers/api/v1/repo/pull.go Co-authored-by: zeripath <art27@cantab.net> 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 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