mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-21 06:20:31 +00:00
fix(lfs): ensure lock listing paginates with a total order (#38850)
`GetLFSLockByRepoID` applies `LIMIT`/`OFFSET` to a query with no `ORDER BY`. The order of such a query is unspecified (according to the SQL standard), so the resulting queryset might be inconsistent. These locks AFAIK are never updated, so in practice the order is insertion-based, but that's not guaranteed.
This commit is contained in:
@@ -124,7 +124,7 @@ func GetLFSLockByRepoID(ctx context.Context, repoID int64, page, pageSize int) (
|
||||
e.Limit(pageSize, start)
|
||||
}
|
||||
lfsLocks := make(LFSLockList, 0, pageSize)
|
||||
return lfsLocks, e.Find(&lfsLocks, &LFSLock{RepoID: repoID})
|
||||
return lfsLocks, e.OrderBy("id").Find(&lfsLocks, &LFSLock{RepoID: repoID})
|
||||
}
|
||||
|
||||
// GetTreePathLock returns LSF lock for the treePath
|
||||
|
||||
Reference in New Issue
Block a user