Commit f698e13b1f3740d1b1dc5fd0ba4e3b4773e2c2e9

limit the amount of lines rendered in a diff

Commit diff

Support/app/views/diff/_diff_result.html.erb

 
3232 </thead>
3333 <tbody>
3434 <% diff_result[:lines].each do |line|
35 next if @diff_line_count >= Git::DEFAULT_DIFF_LIMIT
36 @diff_line_count += 1
3537 line_num_class, row_class = case line[:type]
3638 when :deletion then ["", "del"]
3739 when :insertion then ["", "ins"]
toggle raw diff

Support/app/views/diff/_diff_results.html.erb

 
1<% @diff_line_count = 0 %>
12<% revision ||= nil %>
23<code>
34 <% diff_results.each do |diff_result| %>
5 <% next if @diff_line_count >= Git::DEFAULT_DIFF_LIMIT %>
46 <% render "diff/_diff_result", :locals => {:diff_result => diff_result, :revision => revision } %>
57 <% flush %>
68 <% end %>
7</code>
9</code>
10<% if @diff_line_count >= Git::DEFAULT_DIFF_LIMIT %>
11 <h2>Diff taking to long to render... aborted</h2>
12<% end %>
toggle raw diff

Support/lib/git.rb

 
2121 'X' => {:short => 'X', :long => 'external', :foreground => '#800080', :background => '#edaef5'},
2222 }
2323
24 DEFAULT_DIFF_LIMIT = 3000
25
2426 def short_rev(rev)
2527 rev.to_s[0..7]
2628 end
toggle raw diff