From 0902ba524f6bfa7f7f6d234378c8847b541d1586 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 3 Nov 2016 23:43:17 +0800 Subject: Initialize @statuses in status rather than constructor Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7034#note_17742312 --- app/models/commit.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/commit.rb b/app/models/commit.rb index 1fbda6f6acc..9e7fde9503d 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -57,7 +57,6 @@ class Commit @raw = raw_commit @project = project - @statuses = {} end def id @@ -231,6 +230,8 @@ class Commit end def status(ref = nil) + @statuses ||= {} + if @statuses.key?(ref) @statuses[ref] elsif ref -- cgit v1.2.1