Commit 4b8ac87b authored by Douwe Maan's avatar Douwe Maan

Merge branch 'zj-repository-size' into 'master'

Repository size is Gitaly only

Closes gitaly#393

See merge request gitlab-org/gitlab-ce!20089
parents 19300e7e 4e9491f7
...@@ -403,13 +403,7 @@ module Gitlab ...@@ -403,13 +403,7 @@ module Gitlab
# Return repo size in megabytes # Return repo size in megabytes
def size def size
size = gitaly_migrate(:repository_size) do |is_enabled| size = gitaly_repository_client.repository_size
if is_enabled
size_by_gitaly
else
size_by_shelling_out
end
end
(size.to_f / 1024).round(2) (size.to_f / 1024).round(2)
end end
...@@ -1822,14 +1816,6 @@ module Gitlab ...@@ -1822,14 +1816,6 @@ module Gitlab
commit(sha) commit(sha)
end end
def size_by_shelling_out
popen(%w(du -sk), path).first.strip.to_i
end
def size_by_gitaly
gitaly_repository_client.repository_size
end
# Returns true if the given ref name exists # Returns true if the given ref name exists
# #
# Ref names must start with `refs/`. # Ref names must start with `refs/`.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment