diff --git a/app/models/project.rb b/app/models/project.rb
index 48bb97434393301b2bd3133e029a2753f9b16576..793cf2d70fb7929b8716456d473f4841a0850778 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -430,13 +430,13 @@ class Project < ActiveRecord::Base
   end
 
   def builds_for(build_name, ref = 'HEAD')
-    ct = commit(ref)
+    commit_object = commit(ref)
 
-    if ct.nil?
+    if commit_object.nil?
       builds.none
     else
       builds.joins(:pipeline).
-        merge(Ci::Pipeline.where(sha: ct.sha)).
+        merge(Ci::Pipeline.where(sha: commit_object.sha)).
         where(name: build_name)
     end
   end