summaryrefslogtreecommitdiff
path: root/lib/gitlab_shell.rb
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-04-28 17:10:42 -0300
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-05-11 12:21:31 -0300
commitee259653e7a00359740ca36cef606f9c3cc1a7cb (patch)
tree6f53403454defd386c4455a6a9ffcf052d4c6695 /lib/gitlab_shell.rb
parent1cf14770f3bf5c3255f4c3a8f69ccfab74317fcd (diff)
downloadgitlab-shell-ee259653e7a00359740ca36cef606f9c3cc1a7cb.tar.gz
Handle GL_REPOSITORY env variable and use it in api calls
Diffstat (limited to 'lib/gitlab_shell.rb')
-rw-r--r--lib/gitlab_shell.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index f2e7465..355d493 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -13,7 +13,7 @@ class GitlabShell
API_COMMANDS = %w(2fa_recovery_codes)
GL_PROTOCOL = 'ssh'.freeze
- attr_accessor :key_id, :repo_name, :command, :git_access
+ attr_accessor :key_id, :gl_repository, :repo_name, :command, :git_access
attr_reader :repo_path
def initialize(key_id)
@@ -89,11 +89,12 @@ class GitlabShell
end
def verify_access
- status = api.check_access(@git_access, @repo_name, @key_id, '_any', GL_PROTOCOL)
+ status = api.check_access(@git_access, nil, @repo_name, @key_id, '_any', GL_PROTOCOL)
raise AccessDeniedError, status.message unless status.allowed?
self.repo_path = status.repository_path
+ @gl_repository = status.gl_repository
end
def process_cmd(args)
@@ -125,7 +126,8 @@ class GitlabShell
'LD_LIBRARY_PATH' => ENV['LD_LIBRARY_PATH'],
'LANG' => ENV['LANG'],
'GL_ID' => @key_id,
- 'GL_PROTOCOL' => GL_PROTOCOL
+ 'GL_PROTOCOL' => GL_PROTOCOL,
+ 'GL_REPOSITORY' => @gl_repository
}
if git_trace_available?