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>
This commit is contained in:
M4RKUS-11111 2020-10-27 19:35:28 +01:00 committed by GitHub
parent c9e6069970
commit 732f22ad7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -201,6 +201,12 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
// "422": // "422":
// "$ref": "#/responses/validationError" // "$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 ( var (
repo = ctx.Repo.Repository repo = ctx.Repo.Repository
labelIDs []int64 labelIDs []int64