fix: keep commit count limit in file history pagination static and not increase with every page
This fixes a regression introduced by58a4407acb
from 2022 which reintroduced passing `--skip` to `git rev-list` in favor of the custom skipping reader based on `io.CopyN` from59d1cc49f1
and then forgetting to also revert the `--max-count=CommitsRangeSize*Page` math. Before this commit: ~~~bash # curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=1" | jq length 50 # curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=2" | jq length 100 # curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=10" | jq length 500 ~~~ With this commit applied: ~~~bash # curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=1" | jq length 50 # curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=2" | jq length 50 # curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=10" | jq length 50 ~~~
This commit is contained in:
parent
248977c518
commit
cd2c1361c5
2 changed files with 62 additions and 1 deletions
|
@ -230,7 +230,7 @@ func (repo *Repository) CommitsByFileAndRange(opts CommitsByFileAndRangeOptions)
|
|||
go func() {
|
||||
stderr := strings.Builder{}
|
||||
gitCmd := NewCommand(repo.Ctx, "rev-list").
|
||||
AddOptionFormat("--max-count=%d", setting.Git.CommitsRangeSize*opts.Page).
|
||||
AddOptionFormat("--max-count=%d", setting.Git.CommitsRangeSize).
|
||||
AddOptionFormat("--skip=%d", skip)
|
||||
gitCmd.AddDynamicArguments(opts.Revision)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue