summaryrefslogtreecommitdiff
path: root/lib/gitlab_shell.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-12-13 10:23:17 +0000
committerDouwe Maan <douwe@gitlab.com>2018-12-13 10:23:17 +0000
commit46e81d93ff74a98cf4f02735d310ee4417be0217 (patch)
treec3db905b0890895303b2f1ca91f3ac02664ce48a /lib/gitlab_shell.rb
parent528960c801aed81a977e7ce58a9706b4ea32ab4a (diff)
downloadgitlab-shell-46e81d93ff74a98cf4f02735d310ee4417be0217.tar.gz
Upgrade to Ruby 2.5.3
Diffstat (limited to 'lib/gitlab_shell.rb')
-rw-r--r--lib/gitlab_shell.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index 6ad67c1..87da693 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -81,23 +81,23 @@ class GitlabShell # rubocop:disable Metrics/ClassLength
true
rescue GitlabNet::ApiUnreachableError
- $stderr.puts "GitLab: Failed to authorize your Git request: internal API unreachable"
+ warn "GitLab: Failed to authorize your Git request: internal API unreachable"
false
rescue AccessDeniedError => ex
$logger.warn('Access denied', command: origin_cmd, user: log_username)
- $stderr.puts "GitLab: #{ex.message}"
+ warn "GitLab: #{ex.message}"
false
rescue DisallowedCommandError
$logger.warn('Denied disallowed command', command: origin_cmd, user: log_username)
- $stderr.puts "GitLab: Disallowed command"
+ warn "GitLab: Disallowed command"
false
rescue InvalidRepositoryPathError
- $stderr.puts "GitLab: Invalid repository path"
+ warn "GitLab: Invalid repository path"
false
rescue Action::Custom::BaseError => ex
$logger.warn('Custom action error', exception: ex.class, message: ex.message,
command: origin_cmd, user: log_username)
- $stderr.puts ex.message
+ warn ex.message
false
end
@@ -121,6 +121,7 @@ class GitlabShell # rubocop:disable Metrics/ClassLength
case @command
when GIT_LFS_AUTHENTICATE_COMMAND
raise DisallowedCommandError unless args.count >= 2
+
@repo_name = args[1]
case args[2]
when 'download'
@@ -132,6 +133,7 @@ class GitlabShell # rubocop:disable Metrics/ClassLength
end
else
raise DisallowedCommandError unless args.count == 2
+
@repo_name = args.last
end
@@ -201,7 +203,7 @@ class GitlabShell # rubocop:disable Metrics/ClassLength
begin
if defined?(@who)
@user = api.discover(@who)
- @gl_id = "user-#{@user['id']}" if @user && @user.key?('id')
+ @gl_id = "user-#{@user['id']}" if @user&.key?('id')
else
@user = api.discover(@gl_id)
end