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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d9331147
Commit
d9331147
authored
May 22, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
084c18cf
4edfa510
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
67 additions
and
25 deletions
+67
-25
changelogs/unreleased/dz-scope-project-routes.yml
changelogs/unreleased/dz-scope-project-routes.yml
+5
-0
config/routes/project.rb
config/routes/project.rb
+14
-0
config/routes/repository.rb
config/routes/repository.rb
+1
-1
spec/presenters/merge_request_presenter_spec.rb
spec/presenters/merge_request_presenter_spec.rb
+2
-2
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+35
-20
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+1
-1
spec/support/shared_examples/legacy_path_redirect_shared_examples.rb
...t/shared_examples/legacy_path_redirect_shared_examples.rb
+8
-0
spec/views/help/index.html.haml_spec.rb
spec/views/help/index.html.haml_spec.rb
+1
-1
No files found.
changelogs/unreleased/dz-scope-project-routes.yml
0 → 100644
View file @
d9331147
---
title
:
Move some project routes under /-/ scope
merge_request
:
28435
author
:
type
:
changed
config/routes/project.rb
View file @
d9331147
...
...
@@ -599,4 +599,18 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
end
# Legacy routes.
# Introduced in 12.0.
# Should be removed after 12.1
scope
(
path:
'*namespace_id'
,
as: :namespace
,
namespace_id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
)
do
scope
(
path:
':project_id'
,
constraints:
{
project_id:
Gitlab
::
PathRegex
.
project_route_regex
},
module: :projects
,
as: :project
)
do
Gitlab
::
Routing
.
redirect_legacy_paths
(
self
,
:settings
,
:branches
,
:tags
,
:network
,
:graphs
)
end
end
end
config/routes/repository.rb
View file @
d9331147
...
...
@@ -39,7 +39,7 @@ scope format: false do
end
end
scope
constraints:
{
id:
Gitlab
::
PathRegex
.
git_reference_regex
}
do
scope
path:
'-'
,
constraints:
{
id:
Gitlab
::
PathRegex
.
git_reference_regex
}
do
resources
:network
,
only:
[
:show
]
resources
:graphs
,
only:
[
:show
]
do
...
...
spec/presenters/merge_request_presenter_spec.rb
View file @
d9331147
...
...
@@ -403,7 +403,7 @@ describe MergeRequestPresenter do
allow
(
resource
).
to
receive
(
:source_branch_exists?
)
{
true
}
is_expected
.
to
eq
(
"/
#{
resource
.
source_project
.
full_path
}
/branches/
#{
resource
.
source_branch
}
"
)
.
to
eq
(
"/
#{
resource
.
source_project
.
full_path
}
/
-/
branches/
#{
resource
.
source_branch
}
"
)
end
end
...
...
@@ -426,7 +426,7 @@ describe MergeRequestPresenter do
allow
(
resource
).
to
receive
(
:target_branch_exists?
)
{
true
}
is_expected
.
to
eq
(
"/
#{
resource
.
source_project
.
full_path
}
/branches/
#{
resource
.
target_branch
}
"
)
.
to
eq
(
"/
#{
resource
.
source_project
.
full_path
}
/
-/
branches/
#{
resource
.
target_branch
}
"
)
end
end
...
...
spec/routing/project_routing_spec.rb
View file @
d9331147
...
...
@@ -204,25 +204,27 @@ describe 'project routing' do
describe
Projects
::
BranchesController
,
'routing'
do
it
'to #branches'
do
expect
(
get
(
'/gitlab/gitlabhq/branches'
)).
to
route_to
(
'projects/branches#index'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
)
expect
(
delete
(
'/gitlab/gitlabhq/branches/feature%2345'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature#45'
)
expect
(
delete
(
'/gitlab/gitlabhq/branches/feature%2B45'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature+45'
)
expect
(
delete
(
'/gitlab/gitlabhq/branches/feature@45'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature@45'
)
expect
(
delete
(
'/gitlab/gitlabhq/branches/feature%2345/foo/bar/baz'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature#45/foo/bar/baz'
)
expect
(
delete
(
'/gitlab/gitlabhq/branches/feature%2B45/foo/bar/baz'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature+45/foo/bar/baz'
)
expect
(
delete
(
'/gitlab/gitlabhq/branches/feature@45/foo/bar/baz'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature@45/foo/bar/baz'
)
expect
(
get
(
'/gitlab/gitlabhq/
-/
branches'
)).
to
route_to
(
'projects/branches#index'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
branches/feature%2345'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature#45'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
branches/feature%2B45'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature+45'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
branches/feature@45'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature@45'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
branches/feature%2345/foo/bar/baz'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature#45/foo/bar/baz'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
branches/feature%2B45/foo/bar/baz'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature+45/foo/bar/baz'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
branches/feature@45/foo/bar/baz'
)).
to
route_to
(
'projects/branches#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature@45/foo/bar/baz'
)
end
it_behaves_like
'redirecting a legacy project path'
,
"/gitlab/gitlabhq/branches"
,
"/gitlab/gitlabhq/-/branches"
end
describe
Projects
::
TagsController
,
'routing'
do
it
'to #tags'
do
expect
(
get
(
'/gitlab/gitlabhq/tags'
)).
to
route_to
(
'projects/tags#index'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
)
expect
(
delete
(
'/gitlab/gitlabhq/tags/feature%2345'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature#45'
)
expect
(
delete
(
'/gitlab/gitlabhq/tags/feature%2B45'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature+45'
)
expect
(
delete
(
'/gitlab/gitlabhq/tags/feature@45'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature@45'
)
expect
(
delete
(
'/gitlab/gitlabhq/tags/feature%2345/foo/bar/baz'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature#45/foo/bar/baz'
)
expect
(
delete
(
'/gitlab/gitlabhq/tags/feature%2B45/foo/bar/baz'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature+45/foo/bar/baz'
)
expect
(
delete
(
'/gitlab/gitlabhq/tags/feature@45/foo/bar/baz'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature@45/foo/bar/baz'
)
expect
(
get
(
'/gitlab/gitlabhq/
-/
tags'
)).
to
route_to
(
'projects/tags#index'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
tags/feature%2345'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature#45'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
tags/feature%2B45'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature+45'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
tags/feature@45'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature@45'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
tags/feature%2345/foo/bar/baz'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature#45/foo/bar/baz'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
tags/feature%2B45/foo/bar/baz'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature+45/foo/bar/baz'
)
expect
(
delete
(
'/gitlab/gitlabhq/
-/
tags/feature@45/foo/bar/baz'
)).
to
route_to
(
'projects/tags#destroy'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'feature@45/foo/bar/baz'
)
end
end
...
...
@@ -247,6 +249,7 @@ describe 'project routing' do
it_behaves_like
'RESTful project resources'
do
let
(
:actions
)
{
[
:index
,
:create
,
:destroy
]
}
let
(
:controller
)
{
'protected_branches'
}
let
(
:controller_path
)
{
'/-/protected_branches'
}
end
end
...
...
@@ -592,18 +595,22 @@ describe 'project routing' do
describe
Projects
::
NetworkController
,
'routing'
do
it
'to #show'
do
expect
(
get
(
'/gitlab/gitlabhq/network/master'
)).
to
route_to
(
'projects/network#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master'
)
expect
(
get
(
'/gitlab/gitlabhq/network/ends-with.json'
)).
to
route_to
(
'projects/network#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'ends-with.json'
)
expect
(
get
(
'/gitlab/gitlabhq/network/master?format=json'
)).
to
route_to
(
'projects/network#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master'
,
format:
'json'
)
expect
(
get
(
'/gitlab/gitlabhq/
-/
network/master'
)).
to
route_to
(
'projects/network#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master'
)
expect
(
get
(
'/gitlab/gitlabhq/
-/
network/ends-with.json'
)).
to
route_to
(
'projects/network#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'ends-with.json'
)
expect
(
get
(
'/gitlab/gitlabhq/
-/
network/master?format=json'
)).
to
route_to
(
'projects/network#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master'
,
format:
'json'
)
end
it_behaves_like
'redirecting a legacy project path'
,
"/gitlab/gitlabhq/network/master"
,
"/gitlab/gitlabhq/-/network/master"
end
describe
Projects
::
GraphsController
,
'routing'
do
it
'to #show'
do
expect
(
get
(
'/gitlab/gitlabhq/graphs/master'
)).
to
route_to
(
'projects/graphs#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master'
)
expect
(
get
(
'/gitlab/gitlabhq/graphs/ends-with.json'
)).
to
route_to
(
'projects/graphs#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'ends-with.json'
)
expect
(
get
(
'/gitlab/gitlabhq/graphs/master?format=json'
)).
to
route_to
(
'projects/graphs#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master'
,
format:
'json'
)
expect
(
get
(
'/gitlab/gitlabhq/
-/
graphs/master'
)).
to
route_to
(
'projects/graphs#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master'
)
expect
(
get
(
'/gitlab/gitlabhq/
-/
graphs/ends-with.json'
)).
to
route_to
(
'projects/graphs#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'ends-with.json'
)
expect
(
get
(
'/gitlab/gitlabhq/
-/
graphs/master?format=json'
)).
to
route_to
(
'projects/graphs#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master'
,
format:
'json'
)
end
it_behaves_like
'redirecting a legacy project path'
,
"/gitlab/gitlabhq/graphs/master"
,
"/gitlab/gitlabhq/-/graphs/master"
end
describe
Projects
::
ForksController
,
'routing'
do
...
...
@@ -661,4 +668,12 @@ describe 'project routing' do
end
end
end
describe
Projects
::
Settings
::
RepositoryController
,
'routing'
do
it
'to #show'
do
expect
(
get
(
'/gitlab/gitlabhq/-/settings/repository'
)).
to
route_to
(
'projects/settings/repository#show'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
)
end
it_behaves_like
'redirecting a legacy project path'
,
"/gitlab/gitlabhq/settings/repository"
,
"/gitlab/gitlabhq/-/settings/repository"
end
end
spec/services/system_note_service_spec.rb
View file @
d9331147
...
...
@@ -132,7 +132,7 @@ describe SystemNoteService do
end
it
'sets the note text'
do
link
=
"http://localhost/
#{
project
.
full_path
}
/tags/
#{
tag_name
}
"
link
=
"http://localhost/
#{
project
.
full_path
}
/
-/
tags/
#{
tag_name
}
"
expect
(
subject
.
note
).
to
eq
"tagged commit
#{
noteable
.
sha
}
to [`
#{
tag_name
}
`](
#{
link
}
)"
end
...
...
spec/support/shared_examples/legacy_path_redirect_shared_examples.rb
View file @
d9331147
...
...
@@ -11,3 +11,11 @@ shared_examples 'redirecting a legacy path' do |source, target|
expect
(
get
(
source
)).
not_to
redirect_to
(
target
)
end
end
shared_examples
'redirecting a legacy project path'
do
|
source
,
target
|
include
RSpec
::
Rails
::
RequestExampleGroup
it
"redirects
#{
source
}
to
#{
target
}
"
do
expect
(
get
(
source
)).
to
redirect_to
(
target
)
end
end
spec/views/help/index.html.haml_spec.rb
View file @
d9331147
...
...
@@ -31,7 +31,7 @@ describe 'help/index' do
render
expect
(
rendered
).
to
match
'8.0.2'
expect
(
rendered
).
to
have_link
(
'8.0.2'
,
href:
%r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/tags/v8.0.2}
)
expect
(
rendered
).
to
have_link
(
'8.0.2'
,
href:
%r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/
-/
tags/v8.0.2}
)
end
it
'shows a link to the commit for pre-releases'
do
...
...
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