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
fa40b662
Commit
fa40b662
authored
Oct 04, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix removing the username from the git repository URL for pull mirroring
parent
0a22f17b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
changelogs/unreleased-ee/3588-fix-removing-username-from-import-url.yml
...eleased-ee/3588-fix-removing-username-from-import-url.yml
+5
-0
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+1
-1
spec/features/projects/mirror_spec.rb
spec/features/projects/mirror_spec.rb
+32
-1
No files found.
changelogs/unreleased-ee/3588-fix-removing-username-from-import-url.yml
0 → 100644
View file @
fa40b662
---
title
:
Fix removing the username from the git repository URL for pull mirroring
merge_request
:
3060
author
:
type
:
fixed
ee/app/models/ee/project.rb
View file @
fa40b662
...
...
@@ -366,7 +366,7 @@ module EE
end
url
=
::
Gitlab
::
UrlSanitizer
.
new
(
value
)
creds
=
url
.
credentials
.
slice
(
:user
)
if
url
.
credentials
[
:user
].
present?
creds
=
url
.
credentials
.
slice
(
:user
)
write_attribute
(
:import_url
,
url
.
sanitized_url
)
create_or_update_import_data
(
credentials:
creds
)
...
...
spec/features/projects/mirror_spec.rb
View file @
fa40b662
...
...
@@ -70,11 +70,12 @@ feature 'Project mirror', js: true do
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
visit
project_settings_repository_path
(
project
)
end
describe
'password authentication'
do
it
'can be set up'
do
visit
project_settings_repository_path
(
project
)
page
.
within
(
'.project-mirror-settings'
)
do
check
'Mirror repository'
fill_in
'Git repository URL'
,
with:
'http://user@example.com'
...
...
@@ -89,10 +90,30 @@ feature 'Project mirror', js: true do
expect
(
import_data
.
auth_method
).
to
eq
(
'password'
)
expect
(
project
.
import_url
).
to
eq
(
'http://user:foo@example.com'
)
end
it
'can be changed to unauthenticated'
do
project
.
update!
(
import_url:
'http://user:password@example.com'
)
visit
project_settings_repository_path
(
project
)
page
.
within
(
'.project-mirror-settings'
)
do
fill_in
'Git repository URL'
,
with:
'http://2.example.com'
fill_in
'Password'
,
with:
''
click_without_sidekiq
'Save changes'
end
expect
(
page
).
to
have_content
(
'Mirroring settings were successfully updated'
)
project
.
reload
expect
(
import_data
.
auth_method
).
to
eq
(
'password'
)
expect
(
project
.
import_url
).
to
eq
(
'http://2.example.com'
)
end
end
describe
'SSH public key authentication'
do
it
'can be set up'
do
visit
project_settings_repository_path
(
project
)
page
.
within
(
'.project-mirror-settings'
)
do
check
'Mirror repository'
fill_in
'Git repository URL'
,
with:
'ssh://user@example.com'
...
...
@@ -137,6 +158,8 @@ feature 'Project mirror', js: true do
it
'fills fingerprints and host keys when detecting'
do
stub_reactive_cache
(
cache
,
known_hosts:
key
.
key_text
)
visit
project_settings_repository_path
(
project
)
page
.
within
(
'.project-mirror-settings'
)
do
fill_in
'Git repository URL'
,
with:
'ssh://example.com'
click_on
'Detect host keys'
...
...
@@ -153,6 +176,8 @@ feature 'Project mirror', js: true do
it
'displays error if detection fails'
do
stub_reactive_cache
(
cache
,
error:
'Some error text here'
)
visit
project_settings_repository_path
(
project
)
page
.
within
(
'.project-mirror-settings'
)
do
fill_in
'Git repository URL'
,
with:
'ssh://example.com'
click_on
'Detect host keys'
...
...
@@ -164,6 +189,8 @@ feature 'Project mirror', js: true do
end
it
'allows manual host keys entry'
do
visit
project_settings_repository_path
(
project
)
page
.
within
(
'.project-mirror-settings'
)
do
fill_in
'Git repository URL'
,
with:
'ssh://example.com'
click_on
'Show advanced'
...
...
@@ -178,6 +205,8 @@ feature 'Project mirror', js: true do
describe
'authentication methods'
do
it
'shows SSH related fields for an SSH URL'
do
visit
project_settings_repository_path
(
project
)
page
.
within
(
'.project-mirror-settings'
)
do
fill_in
'Git repository URL'
,
with:
'ssh://example.com'
...
...
@@ -198,6 +227,8 @@ feature 'Project mirror', js: true do
end
it
'hides SSH-related fields for a HTTP URL'
do
visit
project_settings_repository_path
(
project
)
page
.
within
(
'.project-mirror-settings'
)
do
fill_in
'Git repository URL'
,
with:
'https://example.com'
...
...
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