mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	@@ -64,11 +64,6 @@ func (branches BranchList) LoadPusher(ctx context.Context) error {
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const (
 | 
					 | 
				
			||||||
	BranchOrderByNameAsc        = "name ASC"
 | 
					 | 
				
			||||||
	BranchOrderByCommitTimeDesc = "commit_time DESC"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
type FindBranchOptions struct {
 | 
					type FindBranchOptions struct {
 | 
				
			||||||
	db.ListOptions
 | 
						db.ListOptions
 | 
				
			||||||
	RepoID             int64
 | 
						RepoID             int64
 | 
				
			||||||
@@ -102,7 +97,8 @@ func orderByBranches(sess *xorm.Session, opts FindBranchOptions) *xorm.Session {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if opts.OrderBy == "" {
 | 
						if opts.OrderBy == "" {
 | 
				
			||||||
		opts.OrderBy = BranchOrderByCommitTimeDesc
 | 
							// the commit_time might be the same, so add the "name" to make sure the order is stable
 | 
				
			||||||
 | 
							opts.OrderBy = "commit_time DESC, name ASC"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return sess.OrderBy(opts.OrderBy)
 | 
						return sess.OrderBy(opts.OrderBy)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user