Commit 845274e1 authored by James Lopez's avatar James Lopez

Merge branch '31118-do-not-use-blob-for-file-path' into 'master'

When viewing a commit, do not go to the blob for the file path

See merge request gitlab-org/gitlab!17095
parents 8a606030 3328ffe5
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
%a.diff-changed-file{ href: "##{hexdigest(diff_file.file_path)}", title: diff_file.new_path } %a.diff-changed-file{ href: "##{hexdigest(diff_file.file_path)}", title: diff_file.new_path }
= sprite_icon(diff_file_changed_icon(diff_file), size: 16, css_class: "#{diff_file_changed_icon_color(diff_file)} diff-file-changed-icon append-right-8") = sprite_icon(diff_file_changed_icon(diff_file), size: 16, css_class: "#{diff_file_changed_icon_color(diff_file)} diff-file-changed-icon append-right-8")
%span.diff-changed-file-content.append-right-8 %span.diff-changed-file-content.append-right-8
- if diff_file.blob&.name - if diff_file.file_path
%strong.diff-changed-file-name %strong.diff-changed-file-name
= diff_file.blob.name = diff_file.file_path
- else - else
%strong.diff-changed-blank-file-name %strong.diff-changed-blank-file-name
= s_('Diffs|No file name available') = s_('Diffs|No file name available')
......
---
title: Reduce Gitaly calls when viewing a commit
merge_request: 17095
author:
type: performance
...@@ -428,8 +428,8 @@ module Gitlab ...@@ -428,8 +428,8 @@ module Gitlab
def viewer_class_from(classes) def viewer_class_from(classes)
return unless diffable? return unless diffable?
return if different_type? || external_storage_error?
return unless new_file? || deleted_file? || content_changed? return unless new_file? || deleted_file? || content_changed?
return if different_type? || external_storage_error?
verify_binary = !stored_externally? verify_binary = !stored_externally?
......
...@@ -93,13 +93,13 @@ describe 'User browses commits' do ...@@ -93,13 +93,13 @@ describe 'User browses commits' do
context 'when the blob does not exist' do context 'when the blob does not exist' do
let(:commit) { create(:commit, project: project) } let(:commit) { create(:commit, project: project) }
it 'shows a blank label' do it 'renders successfully' do
allow_any_instance_of(Gitlab::Diff::File).to receive(:blob).and_return(nil) allow_any_instance_of(Gitlab::Diff::File).to receive(:blob).and_return(nil)
allow_any_instance_of(Gitlab::Diff::File).to receive(:binary?).and_return(true) allow_any_instance_of(Gitlab::Diff::File).to receive(:binary?).and_return(true)
visit(project_commit_path(project, commit)) visit(project_commit_path(project, commit))
expect(find('.diff-file-changes', visible: false)).to have_content('No file name available') expect(find('.diff-file-changes', visible: false)).to have_content('files/ruby/popen.rb')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment