aboutsummaryrefslogtreecommitdiffstats
path: root/models/git/protected_branch_list.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/git/protected_branch_list.go')
-rw-r--r--models/git/protected_branch_list.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/models/git/protected_branch_list.go b/models/git/protected_branch_list.go
index 613333a5a2..16f8500672 100644
--- a/models/git/protected_branch_list.go
+++ b/models/git/protected_branch_list.go
@@ -28,6 +28,13 @@ func (rules ProtectedBranchRules) sort() {
sort.Slice(rules, func(i, j int) bool {
rules[i].loadGlob()
rules[j].loadGlob()
+
+ // if priority differ, use that to sort
+ if rules[i].Priority != rules[j].Priority {
+ return rules[i].Priority < rules[j].Priority
+ }
+
+ // now we sort the old way
if rules[i].isPlainName != rules[j].isPlainName {
return rules[i].isPlainName // plain name comes first, so plain name means "less"
}