aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorYarden Shoham <git@yardenshoham.com>2023-05-14 15:00:35 +0300
committerGitHub <noreply@github.com>2023-05-14 20:00:35 +0800
commit116f8e12a7db9572161eaba064f71a384ad6eb37 (patch)
tree067dce058c53da05b9c07ffee3578ccb03ebff44 /routers
parent22da9da0e8aae2d247dbd9a5c3ec6aeef2aad249 (diff)
downloadgitea-116f8e12a7db9572161eaba064f71a384ad6eb37.tar.gz
gitea-116f8e12a7db9572161eaba064f71a384ad6eb37.zip
Optimize actions list by removing an unnecessary `git` call (#24710)
We already have the default branch so we don't need to make a `git` call to get it.
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/actions/actions.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go
index 8a44e836c5..2e3a8976b0 100644
--- a/routers/web/repo/actions/actions.go
+++ b/routers/web/repo/actions/actions.go
@@ -61,12 +61,7 @@ func List(ctx *context.Context) {
ctx.Error(http.StatusInternalServerError, err.Error())
return
} else if !empty {
- defaultBranch, err := ctx.Repo.GitRepo.GetDefaultBranch()
- if err != nil {
- ctx.Error(http.StatusInternalServerError, err.Error())
- return
- }
- commit, err := ctx.Repo.GitRepo.GetBranchCommit(defaultBranch)
+ commit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.Repository.DefaultBranch)
if err != nil {
ctx.Error(http.StatusInternalServerError, err.Error())
return