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
Boxiang Sun
gitlab-ce
Commits
c5e44dc5
Commit
c5e44dc5
authored
Jun 05, 2018
by
Imre Farkas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Github repo visibility during import while respecting restricted visibility levels
parent
d8eea0c4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
7 deletions
+44
-7
changelogs/unreleased/47189-github_import_visibility.yml
changelogs/unreleased/47189-github_import_visibility.yml
+6
-0
lib/gitlab/legacy_github_import/project_creator.rb
lib/gitlab/legacy_github_import/project_creator.rb
+4
-1
spec/lib/gitlab/legacy_github_import/project_creator_spec.rb
spec/lib/gitlab/legacy_github_import/project_creator_spec.rb
+34
-6
No files found.
changelogs/unreleased/47189-github_import_visibility.yml
0 → 100644
View file @
c5e44dc5
---
title
:
Use Github repo visibility during import while respecting restricted visibility
levels
merge_request
:
author
:
type
:
fixed
lib/gitlab/legacy_github_import/project_creator.rb
View file @
c5e44dc5
...
...
@@ -35,7 +35,10 @@ module Gitlab
end
def
visibility_level
repo
.
private
?
Gitlab
::
VisibilityLevel
::
PRIVATE
:
Gitlab
::
CurrentSettings
.
default_project_visibility
visibility_level
=
repo
.
private
?
Gitlab
::
VisibilityLevel
::
PRIVATE
:
Gitlab
::
VisibilityLevel
::
PUBLIC
visibility_level
=
Gitlab
::
CurrentSettings
.
default_project_visibility
if
Gitlab
::
CurrentSettings
.
restricted_visibility_levels
.
include?
(
visibility_level
)
visibility_level
end
#
...
...
spec/lib/gitlab/legacy_github_import/project_creator_spec.rb
View file @
c5e44dc5
...
...
@@ -44,7 +44,34 @@ describe Gitlab::LegacyGithubImport::ProjectCreator do
end
context
'when GitHub project is public'
do
it
'sets project visibility to public'
do
repo
.
private
=
false
project
=
service
.
execute
expect
(
project
.
visibility_level
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PUBLIC
)
end
end
context
'when visibility level is restricted'
do
context
'when GitHub project is private'
do
before
do
stub_application_setting
(
restricted_visibility_levels:
[
Gitlab
::
VisibilityLevel
::
PRIVATE
])
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:default_project_visibility
).
and_return
(
Gitlab
::
VisibilityLevel
::
INTERNAL
)
end
it
'sets project visibility to the default project visibility'
do
repo
.
private
=
true
project
=
service
.
execute
expect
(
project
.
visibility_level
).
to
eq
(
Gitlab
::
VisibilityLevel
::
INTERNAL
)
end
end
context
'when GitHub project is public'
do
before
do
stub_application_setting
(
restricted_visibility_levels:
[
Gitlab
::
VisibilityLevel
::
PUBLIC
])
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:default_project_visibility
).
and_return
(
Gitlab
::
VisibilityLevel
::
INTERNAL
)
end
...
...
@@ -56,6 +83,7 @@ describe Gitlab::LegacyGithubImport::ProjectCreator do
expect
(
project
.
visibility_level
).
to
eq
(
Gitlab
::
VisibilityLevel
::
INTERNAL
)
end
end
end
context
'when GitHub project has wiki'
do
it
'does not create the wiki repository'
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