Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-05-05 01:54:25 +0300
committerStan Hu <stanhu@gmail.com>2016-05-05 01:54:25 +0300
commit5653a71635b44263efec43060267dc23f486cfa2 (patch)
tree1f667a8f4f724607aa6d0e9c88262443a93b55dc /app
parent915a4193b433575a63fd4f5048b341d417b06426 (diff)
parent5448970950008fb49092fcfbdb155161d707e10f (diff)
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
Diffstat (limited to 'app')
-rw-r--r--app/helpers/projects_helper.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 3720b0085e5..f17d02a7a3f 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -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)