BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e67574fe
Commit
e67574fe
authored
Aug 21, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4829 from hiroponz/render-not-found-when-failing-to-look-for-commit
Render not found when failing to look for commit
parents
fede36f0
1101ceb3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
14 deletions
+29
-14
network_controller.rb
app/controllers/projects/network_controller.rb
+0
-4
_head.html.haml
app/views/projects/network/_head.html.haml
+3
-3
network.feature
features/project/network.feature
+4
-0
project_network_graph.rb
features/steps/project/project_network_graph.rb
+8
-1
project.rb
features/steps/shared/project.rb
+4
-0
extracts_path.rb
lib/extracts_path.rb
+10
-6
No files found.
app/controllers/projects/network_controller.rb
View file @
e67574fe
...
...
@@ -8,10 +8,6 @@ class Projects::NetworkController < Projects::ApplicationController
before_filter
:require_non_empty_project
def
show
if
@options
[
:q
]
@commit
=
@project
.
repository
.
commit
(
@options
[
:q
])
||
@commit
end
respond_to
do
|
format
|
format
.
html
...
...
app/views/projects/network/_head.html.haml
View file @
e67574fe
...
...
@@ -4,7 +4,7 @@
.pull-left
=
form_tag
project_network_path
(
@project
,
@id
),
method: :get
do
|
f
|
.control-group
=
label_tag
:filter_ref
,
"
Show only selected ref
"
,
class:
'control-label light'
=
label_tag
:filter_ref
,
"
Begin with the selected commit
"
,
class:
'control-label light'
.controls
=
check_box_tag
:filter_ref
,
1
,
@options
[
:filter_ref
]
-
@options
.
each
do
|
key
,
value
|
...
...
@@ -15,9 +15,9 @@
.control-group
=
label_tag
:search
,
"Looking for commit:"
,
class:
'control-label light'
.controls
=
text_field_tag
:
q
,
@options
[
:q
],
placeholder:
"Input SHA
"
,
class:
"search-input input-xlarge"
=
text_field_tag
:
extended_sha1
,
@options
[
:extended_sha1
],
placeholder:
"Input an extended SHA1 syntax
"
,
class:
"search-input input-xlarge"
=
button_tag
type:
'submit'
,
class:
'btn vtop'
do
%i
.icon-search
-
@options
.
each
do
|
key
,
value
|
=
hidden_field_tag
(
key
,
value
,
id:
nil
)
unless
key
==
"
q
"
=
hidden_field_tag
(
key
,
value
,
id:
nil
)
unless
key
==
"
extended_sha1
"
features/project/network.feature
View file @
e67574fe
...
...
@@ -34,3 +34,7 @@ Feature: Project Network Graph
Then
page should not have content not cotaining
"v2.1.0"
When
click
"Show only selected branch"
checkbox
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 @
e67574fe
...
...
@@ -76,7 +76,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
When
'I looking for a commit by SHA of "v2.1.0"'
do
within
".content .search"
do
fill_in
'
q
'
,
with:
'98d6492'
fill_in
'
extended_sha1
'
,
with:
'98d6492'
find
(
'button'
).
click
end
sleep
2
...
...
@@ -87,4 +87,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
page
.
should
have_content
'v2.1.0'
end
end
When
'I look for a commit by ";"'
do
within
".content .search"
do
fill_in
'extended_sha1'
,
with:
';'
find
(
'button'
).
click
end
end
end
features/steps/shared/project.rb
View file @
e67574fe
...
...
@@ -51,6 +51,10 @@ module SharedProject
page
.
should
have_content
(
"Features:"
)
end
Then
'page status code should be 404'
do
page
.
status_code
.
should
==
404
end
def
current_project
@project
||=
Project
.
first
end
...
...
lib/extracts_path.rb
View file @
e67574fe
...
...
@@ -94,19 +94,23 @@ module ExtractsPath
# Automatically renders `not_found!` if a valid tree path could not be
# resolved (e.g., when a user inserts an invalid path or ref).
def
assign_ref_vars
# assign allowed options
allowed_options
=
[
"filter_ref"
,
"extended_sha1"
]
@options
=
params
.
select
{
|
key
,
value
|
allowed_options
.
include?
(
key
)
&&
!
value
.
blank?
}
@options
=
HashWithIndifferentAccess
.
new
(
@options
)
@id
=
get_id
@ref
,
@path
=
extract_ref
(
@id
)
@repo
=
@project
.
repository
@commit
=
@repo
.
commit
(
@ref
)
if
@options
[
:extended_sha1
].
blank?
@commit
=
@repo
.
commit
(
@ref
)
else
@commit
=
@repo
.
commit
(
@options
[
:extended_sha1
])
end
@tree
=
Tree
.
new
(
@repo
,
@commit
.
id
,
@ref
,
@path
)
@hex_path
=
Digest
::
SHA1
.
hexdigest
(
@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?
rescue
RuntimeError
,
NoMethodError
,
InvalidPathError
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