summaryrefslogtreecommitdiffstats
path: root/models/error.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2018-01-05 20:56:50 +0200
committerGitHub <noreply@github.com>2018-01-05 20:56:50 +0200
commit8ac1501ad7f8b350bd9c1bf01b25f994fd3560f9 (patch)
treecf9b661996134da3e39aa6ddd2af4e13f7dbf30f /models/error.go
parenta192f3052ed9b59d1404fdcebf2b5c156d6d6969 (diff)
downloadgitea-8ac1501ad7f8b350bd9c1bf01b25f994fd3560f9.tar.gz
gitea-8ac1501ad7f8b350bd9c1bf01b25f994fd3560f9.zip
Add Pull Request merge options - Ignore white-space for conflict checking, Rebase, Squash merge (#3188)
* Pull request options migration and UI in settings * Add ignore whitespace functionality * Fix settings if pull requests are disabled * Fix migration transaction * Merge with Rebase functionality * UI changes and related functionality for pull request merging button * Implement squash functionality * Fix rebase merging * Fix pull request merge tests * Add squash and rebase tests * Fix API method to reuse default message functions * Some refactoring and small fixes * Remove more hardcoded values from tests * Remove unneeded check from API method * Fix variable name and comment typo * Fix reset commit count after PR merge
Diffstat (limited to 'models/error.go')
-rw-r--r--models/error.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go
index fceee21fdf..765b8fa6ca 100644
--- a/models/error.go
+++ b/models/error.go
@@ -878,6 +878,23 @@ func (err ErrPullRequestAlreadyExists) Error() string {
err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
}
+// ErrInvalidMergeStyle represents an error if merging with disabled merge strategy
+type ErrInvalidMergeStyle struct {
+ ID int64
+ Style MergeStyle
+}
+
+// IsErrInvalidMergeStyle checks if an error is a ErrInvalidMergeStyle.
+func IsErrInvalidMergeStyle(err error) bool {
+ _, ok := err.(ErrInvalidMergeStyle)
+ return ok
+}
+
+func (err ErrInvalidMergeStyle) Error() string {
+ return fmt.Sprintf("merge strategy is not allowed or is invalid [repo_id: %d, strategy: %s]",
+ err.ID, err.Style)
+}
+
// _________ __
// \_ ___ \ ____ _____ _____ ____ _____/ |_
// / \ \/ / _ \ / \ / \_/ __ \ / \ __\