From 46e81d93ff74a98cf4f02735d310ee4417be0217 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 13 Dec 2018 10:23:17 +0000 Subject: Upgrade to Ruby 2.5.3 --- lib/gitlab_shell.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/gitlab_shell.rb') 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 -- cgit v1.2.1