Merge branch 'sh-github-importer-improve-error' into 'master'

GitHub Rake importer: Fail with a clearer explanation if GitLab username is wrong

See merge request gitlab-org/gitlab-ce!19653
This commit is contained in:
James Lopez 2018-06-11 18:29:03 +00:00
commit fa1a75ae28

View file

@ -9,7 +9,10 @@ class GithubImport
def initialize(token, gitlab_username, project_path, extras) def initialize(token, gitlab_username, project_path, extras)
@options = { token: token } @options = { token: token }
@project_path = project_path @project_path = project_path
@current_user = User.find_by_username(gitlab_username) @current_user = User.find_by(username: gitlab_username)
raise "GitLab user #{gitlab_username} not found. Please specify a valid username." unless @current_user
@github_repo = extras.empty? ? nil : extras.first @github_repo = extras.empty? ? nil : extras.first
end end