diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-12-23 15:07:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-23 07:07:12 +0000 |
commit | bd5d1341d43a94ac6b5f646eb9d995a48ba844e1 (patch) | |
tree | a501def0050fa27792e28e38ef749ccb8ad3b5ce /modules/git/repo_commit.go | |
parent | 89f31f79fde96f6cb685ea24a523344f66c5ecf1 (diff) | |
download | gitea-bd5d1341d43a94ac6b5f646eb9d995a48ba844e1.tar.gz gitea-bd5d1341d43a94ac6b5f646eb9d995a48ba844e1.zip |
Fix commit range paging (#32944)
Diffstat (limited to 'modules/git/repo_commit.go')
-rw-r--r-- | modules/git/repo_commit.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index 9ffadb833d..647894bb21 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -216,8 +216,6 @@ type CommitsByFileAndRangeOptions struct { // CommitsByFileAndRange return the commits according revision file and the page func (repo *Repository) CommitsByFileAndRange(opts CommitsByFileAndRangeOptions) ([]*Commit, error) { - skip := (opts.Page - 1) * setting.Git.CommitsRangeSize - stdoutReader, stdoutWriter := io.Pipe() defer func() { _ = stdoutReader.Close() @@ -226,8 +224,8 @@ 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("--skip=%d", skip) + AddOptionFormat("--max-count=%d", setting.Git.CommitsRangeSize). + AddOptionFormat("--skip=%d", (opts.Page-1)*setting.Git.CommitsRangeSize) gitCmd.AddDynamicArguments(opts.Revision) if opts.Not != "" { |