From 116f8e12a7db9572161eaba064f71a384ad6eb37 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sun, 14 May 2023 15:00:35 +0300 Subject: [PATCH] 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. --- routers/web/repo/actions/actions.go | 7 +------ 1 file changed, 1 insertion(+), 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