diff options
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 82876e10446..ff5392957ce 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -12,6 +12,7 @@ class Commit # User can force display of diff above this size DIFF_SAFE_FILES = 100 DIFF_SAFE_LINES = 5000 + # Commits above this size will not be rendered in HTML DIFF_HARD_LIMIT_FILES = 1000 DIFF_HARD_LIMIT_LINES = 50000 @@ -23,23 +24,7 @@ class Commit # Calculate number of lines to render for diffs def diff_line_count(diffs) - diffs.reduce(0){|sum, d| sum + d.diff.lines.count} - end - - def diff_suppress?(diffs, line_count = nil) - # optimize - check file count first - return true if diffs.size > DIFF_SAFE_FILES - - line_count ||= Commit::diff_line_count(diffs) - line_count > DIFF_SAFE_LINES - end - - def diff_force_suppress?(diffs, line_count = nil) - # optimize - check file count first - return true if diffs.size > DIFF_HARD_LIMIT_FILES - - line_count ||= Commit::diff_line_count(diffs) - line_count > DIFF_HARD_LIMIT_LINES + diffs.reduce(0) { |sum, d| sum + d.diff.lines.count } end end @@ -60,14 +45,6 @@ class Commit @diff_line_count end - def diff_suppress? - Commit::diff_suppress?(self.diffs, diff_line_count) - end - - def diff_force_suppress? - Commit::diff_force_suppress?(self.diffs, diff_line_count) - end - # Returns a string describing the commit for use in a link title # # Example |