We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8c776c commit c6176eeCopy full SHA for c6176ee
models/git/branch_list.go
@@ -107,17 +107,13 @@ func (opts FindBranchOptions) ToConds() builder.Cond {
107
108
func (opts FindBranchOptions) ToOrders() string {
109
orderBy := opts.OrderBy
110
- if opts.IsDeletedBranch.ValueOrDefault(true) { // if deleted branch included, put them at the end
111
- if orderBy != "" {
112
- orderBy += ", "
113
- }
114
- orderBy += "is_deleted ASC"
115
116
if orderBy == "" {
117
// the commit_time might be the same, so add the "name" to make sure the order is stable
118
- return "commit_time DESC, name ASC"
+ orderBy = "commit_time DESC, name ASC"
+ }
+ if opts.IsDeletedBranch.ValueOrDefault(true) { // if deleted branch included, put them at the beginning
+ orderBy = "is_deleted ASC, " + orderBy
119
}
120
-
121
return orderBy
122
123
0 commit comments