summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-03-28 04:13:18 +0000
committerGitHub <noreply@github.com>2020-03-28 01:13:18 -0300
commit7cd47046ea6e1fde2c88290a42f345795aee0ea4 (patch)
tree6004084e3c478a68a47b47deb0143a2b142fb821 /routers/api/v1/repo
parentcac30abefc02e36ed08810b7101b4f6a7c8bb599 (diff)
downloadgitea-7cd47046ea6e1fde2c88290a42f345795aee0ea4.tar.gz
gitea-7cd47046ea6e1fde2c88290a42f345795aee0ea4.zip
Handle push rejection in branch and upload (#10854)
* Handle push rejections and push out-of-date in branch creation and file upload. * Remove the duplicated sanitize from services/pull/merge * Move the errors Err(Merge)PushOutOfDate and ErrPushRejected to modules/git * Handle errors better in the upload file dialogs Fix #10460 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r--routers/api/v1/repo/pull.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 428f112633..86df3920c8 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -678,11 +678,11 @@ func MergePullRequest(ctx *context.APIContext, form auth.MergePullRequestForm) {
} else if models.IsErrMergeUnrelatedHistories(err) {
conflictError := err.(models.ErrMergeUnrelatedHistories)
ctx.JSON(http.StatusConflict, conflictError)
- } else if models.IsErrMergePushOutOfDate(err) {
+ } else if git.IsErrPushOutOfDate(err) {
ctx.Error(http.StatusConflict, "Merge", "merge push out of date")
return
- } else if models.IsErrPushRejected(err) {
- errPushRej := err.(models.ErrPushRejected)
+ } else if git.IsErrPushRejected(err) {
+ errPushRej := err.(*git.ErrPushRejected)
if len(errPushRej.Message) == 0 {
ctx.Error(http.StatusConflict, "Merge", "PushRejected without remote error message")
return