diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-03-20 10:19:00 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-03-20 10:19:00 +0200 |
commit | 6347e9a60bd3c00a6a6616756ecc398079775fb2 (patch) | |
tree | 1816cf63f930793ee615d0e77599ab2ac15699dd | |
parent | 72db22d385ad98eea44bdc880ca08c95f867241e (diff) | |
download | gitlab-ce-6347e9a60bd3c00a6a6616756ecc398079775fb2.tar.gz |
Dont load diff in compare over 100 commits
-rw-r--r-- | app/models/commit.rb | 9 | ||||
-rw-r--r-- | app/views/compare/show.html.haml | 6 |
2 files changed, 14 insertions, 1 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 17d41f27f34..daba5414afa 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -89,7 +89,14 @@ class Commit if first && last result[:same] = (first.id == last.id) result[:commits] = project.repo.commits_between(last.id, first.id).map {|c| Commit.new(c)} - result[:diffs] = project.repo.diff(last.id, first.id) rescue [] + + # Dont load diff for 100+ commits + result[:diffs] = if result[:commits].size > 100 + [] + else + project.repo.diff(last.id, first.id) rescue [] + end + result[:commit] = Commit.new(first) end diff --git a/app/views/compare/show.html.haml b/app/views/compare/show.html.haml index d8ea3727d57..476be2550af 100644 --- a/app/views/compare/show.html.haml +++ b/app/views/compare/show.html.haml @@ -6,6 +6,12 @@ = render "form" +- if @commits.size > 100 + .alert.alert-block + %p + %strong Warning! This comparison include 100+ commits. + %p To prevent performance issue we dont show diff information. + - if @commits.present? %div.ui-box %h5.title |