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
This commit is contained in:
Stan Hu 2016-05-04 22:54:25 +00:00
commit 5653a71635

View file

@ -200,12 +200,8 @@ module ProjectsHelper
end
def repository_size(project = @project)
"#{project.repository_size} MB"
rescue
# In order to prevent 500 error
# when application cannot allocate memory
# to calculate repo size - just show 'Unknown'
'unknown'
size_in_bytes = project.repository_size * 1.megabyte
number_to_human_size(size_in_bytes, delimiter: ',', precision: 2)
end
def default_url_to_repo(project = @project)