Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
5f8255ac
Commit
5f8255ac
authored
Oct 14, 2011
by
gitlabhq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed: invalid browse code for commit. Perfomance test added
parent
153f6cd8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
2 deletions
+40
-2
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+2
-0
app/views/projects/_tree_file.html.haml
app/views/projects/_tree_file.html.haml
+0
-1
app/views/projects/_tree_item.html.haml
app/views/projects/_tree_item.html.haml
+1
-1
spec/requests/projects_tree_perfomance_spec.rb
spec/requests/projects_tree_perfomance_spec.rb
+37
-0
No files found.
app/controllers/projects_controller.rb
View file @
5f8255ac
...
@@ -34,6 +34,8 @@ class ProjectsController < ApplicationController
...
@@ -34,6 +34,8 @@ class ProjectsController < ApplicationController
def
tree
def
tree
load_refs
# load @branch, @tag & @ref
load_refs
# load @branch, @tag & @ref
@repo
=
project
.
repo
@repo
=
project
.
repo
if
params
[
:commit_id
]
if
params
[
:commit_id
]
...
...
app/views/projects/_tree_file.html.haml
View file @
5f8255ac
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
.view_file_header
.view_file_header
%strong
%strong
=
name
=
name
-#= file.mime_type
=
link_to
"raw"
,
blob_project_path
(
@project
,
:commit_id
=>
@commit
.
id
,
:path
=>
params
[
:path
]
),
:class
=>
"right"
,
:target
=>
"_blank"
=
link_to
"raw"
,
blob_project_path
(
@project
,
:commit_id
=>
@commit
.
id
,
:path
=>
params
[
:path
]
),
:class
=>
"right"
,
:target
=>
"_blank"
=
link_to
"history"
,
project_commits_path
(
@project
,
:path
=>
params
[
:path
]),
:class
=>
"right"
,
:style
=>
"margin-right:10px;"
=
link_to
"history"
,
project_commits_path
(
@project
,
:path
=>
params
[
:path
]),
:class
=>
"right"
,
:style
=>
"margin-right:10px;"
%br
/
%br
/
...
...
app/views/projects/_tree_item.html.haml
View file @
5f8255ac
-
file
=
params
[
:path
]
?
File
.
join
(
params
[
:path
],
content
.
name
)
:
content
.
name
-
file
=
params
[
:path
]
?
File
.
join
(
params
[
:path
],
content
.
name
)
:
content
.
name
-
content_commit
=
@project
.
repo
.
log
(
@
branch
,
file
,
:max_count
=>
1
).
last
-
content_commit
=
@project
.
repo
.
log
(
@
commit
.
id
,
file
,
:max_count
=>
1
).
last
-
return
unless
content_commit
-
return
unless
content_commit
%tr
{
:class
=>
"tree-item"
,
:url
=>
tree_file_project_path
(
@project
,
@commit
.
id
,
file
)
}
%tr
{
:class
=>
"tree-item"
,
:url
=>
tree_file_project_path
(
@project
,
@commit
.
id
,
file
)
}
%td
.tree-item-file-name
%td
.tree-item-file-name
...
...
spec/requests/projects_tree_perfomance_spec.rb
0 → 100644
View file @
5f8255ac
require
'spec_helper'
require
'benchmark'
describe
"Projects"
do
before
{
login_as
:user
}
describe
"GET /projects/tree"
do
describe
"head"
do
before
do
@project
=
Factory
:project
@project
.
add_access
(
@user
,
:read
)
end
it
"should be fast"
do
time
=
Benchmark
.
realtime
do
visit
tree_project_path
(
@project
)
end
(
time
<
1.0
).
should
be_true
end
end
describe
ValidCommit
::
ID
do
before
do
@project
=
Factory
:project
@project
.
add_access
(
@user
,
:read
)
end
it
"should be fast"
do
time
=
Benchmark
.
realtime
do
visit
tree_project_path
(
@project
,
:commit_id
=>
ValidCommit
::
ID
)
end
(
time
<
1.0
).
should
be_true
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment