diff --git a/app/controllers/projects/blame_controller.rb b/app/controllers/projects/blame_controller.rb
index 3362264dccee2f940f3a72c37580d1b0b68e4d4e..45e157c90cb1d522407d4e41d0c28ce508b02623 100644
--- a/app/controllers/projects/blame_controller.rb
+++ b/app/controllers/projects/blame_controller.rb
@@ -7,7 +7,7 @@ class Projects::BlameController < Projects::ApplicationController
   before_action :authorize_download_code!
 
   def show
+    @blob = @repository.blob_at(@commit.id, @path)
     @blame = Gitlab::Git::Blame.new(@repository, @commit.id, @path)
-    @blob = @blame.blob
   end
 end
diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml
index 8019c7f45696ad2952784e23005edf5b67210161..1705bda307478e86b9c103fafa5a41de762c9525 100644
--- a/app/views/projects/blame/show.html.haml
+++ b/app/views/projects/blame/show.html.haml
@@ -12,25 +12,26 @@
         = render "projects/blob/actions"
     .file-content.blame.highlight
       %table
-        - @blame.each do |commit, lines, since|
-          - commit = Commit.new(commit, @project)
+        - current_line = 1
+        - @blame.each do |raw_commit, line|
           %tr
             %td.blame-commit
               %span.commit
-                = link_to commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit), class: "commit_short_id"
-                &nbsp;
-                = commit_author_link(commit, avatar: true, size: 16)
-                &nbsp;
-                = link_to_gfm truncate(commit.title, length: 20), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "row_title"
+                - unless @prev_commit && @prev_commit.sha == raw_commit.sha
+                  - commit = Commit.new(raw_commit, @project)
+                  = link_to commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit), class: "commit_short_id"
+                  &nbsp;
+                  = commit_author_link(commit, avatar: true, size: 16)
+                  &nbsp;
+                  = link_to_gfm truncate(commit.title, length: 20), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "row_title"
+                - @prev_commit = raw_commit
             %td.lines.blame-numbers
               %pre
-                - (since...(since + lines.count)).each do |i|
-                  = i
-                  \
+                = current_line
+                - current_line += 1
             %td.lines
               %pre{class: 'code highlight white'}
                 %code
                   :erb
-                    <% lines.each do |line| %>
-                      <%= highlight(@blob.name, line, nowrap: true, continue: true).html_safe %>
-                    <% end %>
+                    <%= highlight(@blob.name, line, nowrap: true, continue: true).html_safe %>
+                    
\ No newline at end of file