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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
5f24bdb7
Commit
5f24bdb7
authored
Aug 21, 2013
by
Hiroyuki Sato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render not found when failing to look for a commit
parent
0a44ecf3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
10 deletions
+25
-10
app/controllers/projects/network_controller.rb
app/controllers/projects/network_controller.rb
+0
-4
features/project/network.feature
features/project/network.feature
+4
-0
features/steps/project/project_network_graph.rb
features/steps/project/project_network_graph.rb
+7
-0
features/steps/shared/project.rb
features/steps/shared/project.rb
+4
-0
lib/extracts_path.rb
lib/extracts_path.rb
+10
-6
No files found.
app/controllers/projects/network_controller.rb
View file @
5f24bdb7
...
@@ -8,10 +8,6 @@ class Projects::NetworkController < Projects::ApplicationController
...
@@ -8,10 +8,6 @@ class Projects::NetworkController < Projects::ApplicationController
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
def
show
def
show
if
@options
[
:q
]
@commit
=
@project
.
repository
.
commit
(
@options
[
:q
])
||
@commit
end
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
...
...
features/project/network.feature
View file @
5f24bdb7
...
@@ -34,3 +34,7 @@ Feature: Project Network Graph
...
@@ -34,3 +34,7 @@ Feature: Project Network Graph
Then
page should not have content not cotaining
"v2.1.0"
Then
page should not have content not cotaining
"v2.1.0"
When
click
"Show only selected branch"
checkbox
When
click
"Show only selected branch"
checkbox
Then
page should have content not cotaining
"v2.1.0"
Then
page should have content not cotaining
"v2.1.0"
Scenario
:
I
should fail to look for a commit
When
I look for a commit by
";"
Then
page status code should be 404
features/steps/project/project_network_graph.rb
View file @
5f24bdb7
...
@@ -87,4 +87,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
...
@@ -87,4 +87,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
page
.
should
have_content
'v2.1.0'
page
.
should
have_content
'v2.1.0'
end
end
end
end
When
'I look for a commit by ";"'
do
within
".content .search"
do
fill_in
'q'
,
with:
';'
find
(
'button'
).
click
end
end
end
end
features/steps/shared/project.rb
View file @
5f24bdb7
...
@@ -51,6 +51,10 @@ module SharedProject
...
@@ -51,6 +51,10 @@ module SharedProject
page
.
should
have_content
(
"Features:"
)
page
.
should
have_content
(
"Features:"
)
end
end
Then
'page status code should be 404'
do
page
.
status_code
.
should
==
404
end
def
current_project
def
current_project
@project
||=
Project
.
first
@project
||=
Project
.
first
end
end
...
...
lib/extracts_path.rb
View file @
5f24bdb7
...
@@ -94,19 +94,23 @@ module ExtractsPath
...
@@ -94,19 +94,23 @@ module ExtractsPath
# Automatically renders `not_found!` if a valid tree path could not be
# Automatically renders `not_found!` if a valid tree path could not be
# resolved (e.g., when a user inserts an invalid path or ref).
# resolved (e.g., when a user inserts an invalid path or ref).
def
assign_ref_vars
def
assign_ref_vars
# assign allowed options
allowed_options
=
[
"filter_ref"
,
"q"
]
@options
=
params
.
select
{
|
key
,
value
|
allowed_options
.
include?
(
key
)
&&
!
value
.
blank?
}
@options
=
HashWithIndifferentAccess
.
new
(
@options
)
@id
=
get_id
@id
=
get_id
@ref
,
@path
=
extract_ref
(
@id
)
@ref
,
@path
=
extract_ref
(
@id
)
@repo
=
@project
.
repository
@repo
=
@project
.
repository
@commit
=
@repo
.
commit
(
@ref
)
if
@options
[
:q
].
blank?
@commit
=
@repo
.
commit
(
@ref
)
else
@commit
=
@repo
.
commit
(
@options
[
:q
])
end
@tree
=
Tree
.
new
(
@repo
,
@commit
.
id
,
@ref
,
@path
)
@tree
=
Tree
.
new
(
@repo
,
@commit
.
id
,
@ref
,
@path
)
@hex_path
=
Digest
::
SHA1
.
hexdigest
(
@path
)
@hex_path
=
Digest
::
SHA1
.
hexdigest
(
@path
)
@logs_path
=
logs_file_project_ref_path
(
@project
,
@ref
,
@path
)
@logs_path
=
logs_file_project_ref_path
(
@project
,
@ref
,
@path
)
# assign allowed options
allowed_options
=
[
"filter_ref"
,
"q"
]
@options
=
params
.
select
{
|
key
,
value
|
allowed_options
.
include?
(
key
)
&&
!
value
.
blank?
}
@options
=
HashWithIndifferentAccess
.
new
(
@options
)
raise
InvalidPathError
unless
@tree
.
exists?
raise
InvalidPathError
unless
@tree
.
exists?
rescue
RuntimeError
,
NoMethodError
,
InvalidPathError
rescue
RuntimeError
,
NoMethodError
,
InvalidPathError
not_found!
not_found!
...
...
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