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>
This commit is contained in:
zeripathandLauris BH authored and GitHub committed 2020-02-22 15:08:48 +02:00
1 parent 2ed9ead6de
commit 089ccb0c80
8 files changed
+134 -15

No files matched your search

+9
View File
@@ -392,6 +392,15 @@ func rawMerge(pr *models.PullRequest, doer *models.User, mergeStyle models.Merge
StdErr: errbuf.String(),
Err: err,
}
} else if strings.Contains(errbuf.String(), "! [remote rejected]") {
err := models.ErrPushRejected{
Style: mergeStyle,
StdOut: outbuf.String(),
StdErr: errbuf.String(),
Err: err,
}
err.GenerateMessage()
return "", err
}
return "", fmt.Errorf("git push: %s", errbuf.String())
}