diff --git a/lib/kmxgit/repository_manager/repository.ex b/lib/kmxgit/repository_manager/repository.ex
index 24de02a..b3aade9 100644
--- a/lib/kmxgit/repository_manager/repository.ex
+++ b/lib/kmxgit/repository_manager/repository.ex
@@ -3,6 +3,7 @@ defmodule Kmxgit.RepositoryManager.Repository do
use Ecto.Schema
import Ecto.Changeset
+ alias Kmxgit.GitManager
alias Kmxgit.RepositoryManager
alias Kmxgit.OrganisationManager.Organisation
alias Kmxgit.UserManager.User
@@ -203,4 +204,9 @@ defmodule Kmxgit.RepositoryManager.Repository do
end)
|> Enum.join("\n")
end
+
+ def disk_usage(repo) do
+ {:ok, {du, _}} = GitManager.disk_usage(full_slug(repo))
+ du
+ end
end
diff --git a/lib/kmxgit_web/controllers/repository_controller.ex b/lib/kmxgit_web/controllers/repository_controller.ex
index 0b6d6c4..025c355 100644
--- a/lib/kmxgit_web/controllers/repository_controller.ex
+++ b/lib/kmxgit_web/controllers/repository_controller.ex
@@ -405,7 +405,6 @@ defmodule KmxgitWeb.RepositoryController do
|> render("tag.html")
end
defp show_op(conn, :tree, %{tree: tree, git: git, org: org, path: path, repo: repo, user: user}) do
- {:ok, {repo_size, _}} = GitManager.disk_usage(Repository.full_slug(repo))
conn
|> assign(:tree, tree)
|> assign(:tree_url, tree && Routes.repository_path(conn, :show, Repository.owner_slug(repo), Repository.splat(repo, ["_tree", tree] ++ (if path, do: String.split(path, "/"), else: []))))
@@ -413,7 +412,7 @@ defmodule KmxgitWeb.RepositoryController do
|> assign(:current_repository, repo)
|> assign(:git, git)
|> assign(:repo, repo)
- |> assign(:repo_size, repo_size)
+ |> assign(:repo_size, Repository.disk_usage(repo))
|> assign(:members, Repository.members(repo))
|> assign(:owner, org || user)
|> assign(:path, path)