aboutsummaryrefslogtreecommitdiffstats
path: root/services/wiki/wiki.go
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 /services/wiki/wiki.go
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 'services/wiki/wiki.go')
-rw-r--r--services/wiki/wiki.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/services/wiki/wiki.go b/services/wiki/wiki.go
index 2ace1d7a08..3616823c5d 100644
--- a/services/wiki/wiki.go
+++ b/services/wiki/wiki.go
@@ -212,6 +212,9 @@ func updateWikiPage(doer *models.User, repo *models.Repository, oldWikiName, new
),
}); err != nil {
log.Error("%v", err)
+ if git.IsErrPushOutOfDate(err) || git.IsErrPushRejected(err) {
+ return err
+ }
return fmt.Errorf("Push: %v", err)
}
@@ -316,6 +319,9 @@ func DeleteWikiPage(doer *models.User, repo *models.Repository, wikiName string)
Branch: fmt.Sprintf("%s:%s%s", commitHash.String(), git.BranchPrefix, "master"),
Env: models.PushingEnvironment(doer, repo),
}); err != nil {
+ if git.IsErrPushOutOfDate(err) || git.IsErrPushRejected(err) {
+ return err
+ }
return fmt.Errorf("Push: %v", err)
}