Commit 5653a716 authored by Stan Hu's avatar Stan Hu

Merge branch 'rs-repository-size-format' into 'master'

Use `number_to_human_size` helper to show repository size

This will intelligently format large repository sizes in GBs (or,
shudder, TBs).

Also, removes `rescue` clause from `repository_size` helper.
The repository size has since become calculated (and cached)
more intelligently, and this should no longer be necessary.

See merge request !4047
parents 915a4193 54489709
...@@ -200,12 +200,8 @@ module ProjectsHelper ...@@ -200,12 +200,8 @@ module ProjectsHelper
end end
def repository_size(project = @project) def repository_size(project = @project)
"#{project.repository_size} MB" size_in_bytes = project.repository_size * 1.megabyte
rescue number_to_human_size(size_in_bytes, delimiter: ',', precision: 2)
# In order to prevent 500 error
# when application cannot allocate memory
# to calculate repo size - just show 'Unknown'
'unknown'
end end
def default_url_to_repo(project = @project) def default_url_to_repo(project = @project)
......
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