]> source.dussan.org Git - gitea.git/commitdiff
Optimize actions list by removing an unnecessary `git` call (#24710)
authorYarden Shoham <git@yardenshoham.com>
Sun, 14 May 2023 12:00:35 +0000 (15:00 +0300)
committerGitHub <noreply@github.com>
Sun, 14 May 2023 12:00:35 +0000 (20:00 +0800)
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

index 8a44e836c504545b000782a6e7ff6b913191342c..2e3a8976b09b78eb121e0b4c714ee296b6c4f090 100644 (file)
@@ -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