Commit 5f8255ac67e26d8d7dc98cff37ecae5eab4ab3cf
1 parent
153f6cd8
Exists in
master
and in
4 other branches
Fixed: invalid browse code for commit. Perfomance test added
Showing
4 changed files
with
40 additions
and
2 deletions
Show diff stats
app/controllers/projects_controller.rb
app/views/projects/_tree_file.html.haml
... | ... | @@ -3,7 +3,6 @@ |
3 | 3 | .view_file_header |
4 | 4 | %strong |
5 | 5 | = name |
6 | - -#= file.mime_type | |
7 | 6 | = link_to "raw", blob_project_path(@project, :commit_id => @commit.id, :path => params[:path] ), :class => "right", :target => "_blank" |
8 | 7 | = link_to "history", project_commits_path(@project, :path => params[:path]), :class => "right", :style => "margin-right:10px;" |
9 | 8 | %br/ | ... | ... |
app/views/projects/_tree_item.html.haml
1 | 1 | - file = params[:path] ? File.join(params[:path], content.name) : content.name |
2 | -- content_commit = @project.repo.log(@branch, file, :max_count => 1).last | |
2 | +- content_commit = @project.repo.log(@commit.id, file, :max_count => 1).last | |
3 | 3 | - return unless content_commit |
4 | 4 | %tr{ :class => "tree-item", :url => tree_file_project_path(@project, @commit.id, file) } |
5 | 5 | %td.tree-item-file-name | ... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +require 'spec_helper' | |
2 | +require 'benchmark' | |
3 | + | |
4 | +describe "Projects" do | |
5 | + before { login_as :user } | |
6 | + | |
7 | + describe "GET /projects/tree" do | |
8 | + describe "head" do | |
9 | + before do | |
10 | + @project = Factory :project | |
11 | + @project.add_access(@user, :read) | |
12 | + | |
13 | + end | |
14 | + | |
15 | + it "should be fast" do | |
16 | + time = Benchmark.realtime do | |
17 | + visit tree_project_path(@project) | |
18 | + end | |
19 | + (time < 1.0).should be_true | |
20 | + end | |
21 | + end | |
22 | + | |
23 | + describe ValidCommit::ID do | |
24 | + before do | |
25 | + @project = Factory :project | |
26 | + @project.add_access(@user, :read) | |
27 | + end | |
28 | + | |
29 | + it "should be fast" do | |
30 | + time = Benchmark.realtime do | |
31 | + visit tree_project_path(@project, :commit_id => ValidCommit::ID) | |
32 | + end | |
33 | + (time < 1.0).should be_true | |
34 | + end | |
35 | + end | |
36 | + end | |
37 | +end | ... | ... |