-
- Downloads
Manually set total_count when paginating commits
`Kaminari.paginate_array` takes some options, most relevant of which is a `total_count` parameter. Using the `commit_count` for `total_count` lets us correctly treat the return of `Repository#commits` as a subset of all the commits we may wish to list. Addition of a new `Repository#commit_count_for_ref` method was necessarry to allow the user to start from an arbitrary ref. Ref #1381
Showing
- app/models/repository.rb 10 additions, 0 deletionsapp/models/repository.rb
- changelogs/unreleased/1381-use-commit-count-for-pagination.yml 4 additions, 0 deletions...elogs/unreleased/1381-use-commit-count-for-pagination.yml
- lib/api/commits.rb 4 additions, 1 deletionlib/api/commits.rb
- spec/models/repository_spec.rb 18 additions, 3 deletionsspec/models/repository_spec.rb
- spec/requests/api/commits_spec.rb 37 additions, 0 deletionsspec/requests/api/commits_spec.rb
Please register or sign in to comment