From e731c0fdffa87bf7cd0b4a898b9f2fda3d8e9a1d Mon Sep 17 00:00:00 2001 From: Marko Gacesa Date: Mon, 6 Nov 2023 12:16:18 +0000 Subject: [PATCH] require latest source sha as param for the merge API (#767) --- app/api/controller/pullreq/merge.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/api/controller/pullreq/merge.go b/app/api/controller/pullreq/merge.go index 2d43cabb5..b95406d09 100644 --- a/app/api/controller/pullreq/merge.go +++ b/app/api/controller/pullreq/merge.go @@ -94,13 +94,10 @@ func (c *Controller) Merge( return nil, nil, usererror.BadRequest("Pull request must be open") } - // TODO: Uncomment when the front-end side starts sending SourceSHA. - /* - if pr.SourceSHA != in.SourceSHA { - return nil, nil, - usererror.BadRequest("A newer commit is available. Only the latest commit can be merged.") - } - */ + if pr.SourceSHA != in.SourceSHA { + return nil, nil, + usererror.BadRequest("A newer commit is available. Only the latest commit can be merged.") + } if pr.IsDraft { return nil, nil, usererror.BadRequest(