public
Description: The Git TextMate Bundle
Homepage: http://tim.theenchanter.com/
Clone URL: git://github.com/timcharper/git-tmbundle.git
limit the amount of lines rendered in a diff
timcharper (author)
Wed Apr 30 09:59:53 -0700 2008
commit  f698e13b1f3740d1b1dc5fd0ba4e3b4773e2c2e9
tree    e511acf9d569c5d0a7d1cd8e02d49452d8e7bf37
parent  8ff8ae42290f2417744896e949b5550ea4dee6b3
...
32
33
34
 
 
35
36
37
...
32
33
34
35
36
37
38
39
0
@@ -32,6 +32,8 @@
0
   </thead>
0
   <tbody>
0
     <% diff_result[:lines].each do |line|
0
+ next if @diff_line_count >= Git::DEFAULT_DIFF_LIMIT
0
+ @diff_line_count += 1
0
       line_num_class, row_class = case line[:type]
0
         when :deletion then ["", "del"]
0
         when :insertion then ["", "ins"]
...
 
1
2
3
 
4
5
6
7
8
 
 
 
 
9
...
1
2
3
4
5
6
7
8
 
9
10
11
12
13
14
0
@@ -1,7 +1,12 @@
0
+<% @diff_line_count = 0 %>
0
 <% revision ||= nil %>
0
 <code>
0
   <% diff_results.each do |diff_result| %>
0
+ <% next if @diff_line_count >= Git::DEFAULT_DIFF_LIMIT %>
0
     <% render "diff/_diff_result", :locals => {:diff_result => diff_result, :revision => revision } %>
0
     <% flush %>
0
   <% end %>
0
-</code>
0
\ No newline at end of file
0
+</code>
0
+<% if @diff_line_count >= Git::DEFAULT_DIFF_LIMIT %>
0
+ <h2>Diff taking to long to render... aborted</h2>
0
+<% end %>
0
\ No newline at end of file
...
21
22
23
 
 
24
25
26
...
21
22
23
24
25
26
27
28
0
@@ -21,6 +21,8 @@ module SCM
0
       'X' => {:short => 'X', :long => 'external', :foreground => '#800080', :background => '#edaef5'},
0
     }
0
     
0
+ DEFAULT_DIFF_LIMIT = 3000
0
+
0
     def short_rev(rev)
0
       rev.to_s[0..7]
0
     end

Comments

    No one has commented yet.