aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/pull.go
diff options
context:
space:
mode:
authorGennady Kovshenin <gennady@kovshenin.com>2022-10-06 06:21:04 +0300
committerGitHub <noreply@github.com>2022-10-06 11:21:04 +0800
commitfd2d5f06b087965ee588f8e74853cd2032130efa (patch)
tree7dba7c7eeedf14e4f0212c2c9fa6315249a5c7b6 /routers/api/v1/repo/pull.go
parent8765f139c7a1f3b5aafb83ae9b095e6066d77a50 (diff)
downloadgitea-fd2d5f06b087965ee588f8e74853cd2032130efa.tar.gz
gitea-fd2d5f06b087965ee588f8e74853cd2032130efa.zip
Add `stat` to `ToCommit` function for speed (#21337)
Calls to ToCommit are very slow due to fetching diffs, analyzing files. This patch lets us supply `stat` as false to speed fetching a commit when we don't need the diff. /v1/repo/commits has a default `stat` set as true now. Set to false to experience fetching thousands of commits per second instead of 2-5 per second.
Diffstat (limited to 'routers/api/v1/repo/pull.go')
-rw-r--r--routers/api/v1/repo/pull.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 2cf30e7c47..f6507dceba 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -1306,7 +1306,7 @@ func GetPullRequestCommits(ctx *context.APIContext) {
apiCommits := make([]*api.Commit, 0, end-start)
for i := start; i < end; i++ {
- apiCommit, err := convert.ToCommit(ctx.Repo.Repository, baseGitRepo, commits[i], userCache)
+ apiCommit, err := convert.ToCommit(ctx.Repo.Repository, baseGitRepo, commits[i], userCache, true)
if err != nil {
ctx.ServerError("toCommit", err)
return