From: Yarden Shoham Date: Sun, 14 May 2023 12:00:35 +0000 (+0300) Subject: Optimize actions list by removing an unnecessary `git` call (#24710) X-Git-Tag: v1.20.0-rc0~210 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=116f8e12a7db9572161eaba064f71a384ad6eb37;p=gitea.git 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. --- 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