From 2e9f03e5141368af6075723969fb031d5315e9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 19 Apr 2016 10:37:50 +0200 Subject: Define constants only if not defined yet and freeze them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- app/models/commit.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index d1f07ccd55c..f5d1e242e75 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -12,11 +12,11 @@ class Commit attr_accessor :project - DIFF_SAFE_LINES = Gitlab::Git::DiffCollection::DEFAULT_LIMITS[:max_lines] + DIFF_SAFE_LINES ||= Gitlab::Git::DiffCollection::DEFAULT_LIMITS[:max_lines] # Commits above this size will not be rendered in HTML - DIFF_HARD_LIMIT_FILES = 1000 unless defined?(DIFF_HARD_LIMIT_FILES) - DIFF_HARD_LIMIT_LINES = 50000 unless defined?(DIFF_HARD_LIMIT_LINES) + DIFF_HARD_LIMIT_FILES ||= 1000 + DIFF_HARD_LIMIT_LINES ||= 50000 class << self def decorate(commits, project) -- cgit v1.2.1