diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index e2cab70adc1..b2b71180a48 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