diff options
author | zeripath <art27@cantab.net> | 2020-02-22 13:08:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-22 15:08:48 +0200 |
commit | 089ccb0c80050efc8c3afef2402ea4f4a5ed250e (patch) | |
tree | 4ff172035ffd0a9a5263dedc051a91ab24c33fa6 /routers/api/v1/repo/pull.go | |
parent | 2ed9ead6dea29f9e006fa1831892c9c239f4bd70 (diff) | |
download | gitea-089ccb0c80050efc8c3afef2402ea4f4a5ed250e.tar.gz gitea-089ccb0c80050efc8c3afef2402ea4f4a5ed250e.zip |
Handle push rejection message in Merge & Web Editor (#10373)
* Handle push rejection message in Merge
* placate golangci-lint
* Fix sanitize, adjust message handling
* oops
* Oops
* Handle push-rejection in webeditor CRUD too
* Apply suggestions from code review
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'routers/api/v1/repo/pull.go')
-rw-r--r-- | routers/api/v1/repo/pull.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index 1abc2806f8..41e17f8c23 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -684,6 +684,14 @@ func MergePullRequest(ctx *context.APIContext, form auth.MergePullRequestForm) { } else if models.IsErrMergePushOutOfDate(err) { ctx.Error(http.StatusConflict, "Merge", "merge push out of date") return + } else if models.IsErrPushRejected(err) { + errPushRej := err.(models.ErrPushRejected) + if len(errPushRej.Message) == 0 { + ctx.Error(http.StatusConflict, "Merge", "PushRejected without remote error message") + return + } + ctx.Error(http.StatusConflict, "Merge", "PushRejected with remote message: "+errPushRej.Message) + return } ctx.Error(http.StatusInternalServerError, "Merge", err) return |