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 /app/models/commit.rb | |
parent | 72db22d385ad98eea44bdc880ca08c95f867241e (diff) | |
download | gitlab-ce-6347e9a60bd3c00a6a6616756ecc398079775fb2.tar.gz |
Dont load diff in compare over 100 commits
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 9 |
1 files changed, 8 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 |