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
51186e72
Commit
51186e72
authored
Jul 14, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a custom root endpoint if defined on GH ominiauth provider settings
parent
81995317
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
lib/github/import.rb
lib/github/import.rb
+16
-1
lib/tasks/import.rake
lib/tasks/import.rake
+1
-1
No files found.
lib/github/import.rb
View file @
51186e72
...
@@ -48,9 +48,9 @@ module Github
...
@@ -48,9 +48,9 @@ module Github
@project
=
project
@project
=
project
@repository
=
project
.
repository
@repository
=
project
.
repository
@repo
=
project
.
import_source
@repo
=
project
.
import_source
@options
=
options
@repo_url
=
project
.
import_url
@repo_url
=
project
.
import_url
@wiki_url
=
project
.
import_url
.
sub
(
/\.git\z/
,
'.wiki.git'
)
@wiki_url
=
project
.
import_url
.
sub
(
/\.git\z/
,
'.wiki.git'
)
@options
=
options
.
reverse_merge
(
url:
root_endpoint
)
@verbose
=
options
.
fetch
(
:verbose
,
false
)
@verbose
=
options
.
fetch
(
:verbose
,
false
)
@cached
=
Hash
.
new
{
|
hash
,
key
|
hash
[
key
]
=
Hash
.
new
}
@cached
=
Hash
.
new
{
|
hash
,
key
|
hash
[
key
]
=
Hash
.
new
}
@errors
=
[]
@errors
=
[]
...
@@ -383,5 +383,20 @@ module Github
...
@@ -383,5 +383,20 @@ module Github
def
error
(
type
,
url
,
message
)
def
error
(
type
,
url
,
message
)
errors
<<
{
type:
type
,
url:
Gitlab
::
UrlSanitizer
.
sanitize
(
url
),
error:
message
}
errors
<<
{
type:
type
,
url:
Gitlab
::
UrlSanitizer
.
sanitize
(
url
),
error:
message
}
end
end
def
root_endpoint
@root_endpoint
||=
custom_endpoint
||
githup_endpoint
end
def
custom_endpoint
Gitlab
.
config
.
omniauth
.
providers
.
find
{
|
provider
|
provider
.
name
==
'github'
}
.
to_h
.
dig
(
'args'
,
'client_options'
,
'site'
)
end
def
github_endpoint
OmniAuth
::
Strategies
::
GitHub
.
default_options
[
:client_options
][
:site
]
end
end
end
end
end
lib/tasks/import.rake
View file @
51186e72
...
@@ -7,7 +7,7 @@ class GithubImport
...
@@ -7,7 +7,7 @@ class GithubImport
end
end
def
initialize
(
token
,
gitlab_username
,
project_path
,
extras
)
def
initialize
(
token
,
gitlab_username
,
project_path
,
extras
)
@options
=
{
url:
'https://api.github.com'
,
token:
token
,
verbose:
true
}
@options
=
{
token:
token
,
verbose:
true
}
@project_path
=
project_path
@project_path
=
project_path
@current_user
=
User
.
find_by_username
(
gitlab_username
)
@current_user
=
User
.
find_by_username
(
gitlab_username
)
@github_repo
=
extras
.
empty?
?
nil
:
extras
.
first
@github_repo
=
extras
.
empty?
?
nil
:
extras
.
first
...
...
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