diff options
| author | James Lopez <james@jameslopez.es> | 2018-07-30 10:58:31 +0200 |
|---|---|---|
| committer | James Lopez <james@jameslopez.es> | 2018-08-01 07:51:04 +0200 |
| commit | 4304099c3fee2382aa10a0edb57d932779b83cc9 (patch) | |
| tree | 0f70d52fcad9dfedfb1ece3334e6d4a5d682f185 /lib | |
| parent | e3fead94b6f71d3501d586cbb2295ea0d1da2b31 (diff) | |
| download | gitlab-shell-4304099c3fee2382aa10a0edb57d932779b83cc9.tar.gz | |
Add Git protocol v2
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gitlab_access_status.rb | 8 | ||||
| -rw-r--r-- | lib/gitlab_net.rb | 3 | ||||
| -rw-r--r-- | lib/gitlab_shell.rb | 7 |
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/gitlab_access_status.rb b/lib/gitlab_access_status.rb index 44225aa..c639462 100644 --- a/lib/gitlab_access_status.rb +++ b/lib/gitlab_access_status.rb @@ -1,9 +1,9 @@ require 'json' class GitAccessStatus - attr_reader :message, :gl_repository, :gl_id, :gl_username, :repository_path, :gitaly + attr_reader :message, :gl_repository, :gl_id, :gl_username, :repository_path, :gitaly, :git_protocol - def initialize(status, message, gl_repository:, gl_id:, gl_username:, repository_path:, gitaly:) + def initialize(status, message, gl_repository:, gl_id:, gl_username:, repository_path:, gitaly:, git_protocol:) @status = status @message = message @gl_repository = gl_repository @@ -11,6 +11,7 @@ class GitAccessStatus @gl_username = gl_username @repository_path = repository_path @gitaly = gitaly + @git_protocol = git_protocol end def self.create_from_json(json) @@ -21,7 +22,8 @@ class GitAccessStatus gl_id: values["gl_id"], gl_username: values["gl_username"], repository_path: values["repository_path"], - gitaly: values["gitaly"]) + gitaly: values["gitaly"], + git_protocol: values["git_protocol"]) end def allowed? diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb index 7013d79..9cb7e56 100644 --- a/lib/gitlab_net.rb +++ b/lib/gitlab_net.rb @@ -44,7 +44,8 @@ class GitlabNet # rubocop:disable Metrics/ClassLength gl_id: nil, gl_username: nil, repository_path: nil, - gitaly: nil) + gitaly: nil, + git_protocol: nil) end end diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb index 9f05004..59aaa89 100644 --- a/lib/gitlab_shell.rb +++ b/lib/gitlab_shell.rb @@ -18,7 +18,7 @@ class GitlabShell # rubocop:disable Metrics/ClassLength API_COMMANDS = %w(2fa_recovery_codes).freeze GL_PROTOCOL = 'ssh'.freeze - attr_accessor :gl_id, :gl_repository, :repo_name, :command, :git_access + attr_accessor :gl_id, :gl_repository, :repo_name, :command, :git_access, :git_protocol attr_reader :repo_path def initialize(who) @@ -118,6 +118,7 @@ class GitlabShell # rubocop:disable Metrics/ClassLength self.repo_path = status.repository_path @gl_repository = status.gl_repository + @git_protocol = status.git_protocol @gitaly = status.gitaly @username = status.gl_username if defined?(@who) @@ -150,7 +151,8 @@ class GitlabShell # rubocop:disable Metrics/ClassLength 'repository' => @gitaly['repository'], 'gl_repository' => @gl_repository, 'gl_id' => @gl_id, - 'gl_username' => @username + 'gl_username' => @username, + 'git_protocol' => @git_protocol } args = [gitaly_address, JSON.dump(gitaly_request)] @@ -178,6 +180,7 @@ class GitlabShell # rubocop:disable Metrics/ClassLength 'GL_ID' => @gl_id, 'GL_PROTOCOL' => GL_PROTOCOL, 'GL_REPOSITORY' => @gl_repository, + 'GIT_PROTOCOL' => @git_protocol, 'GL_USERNAME' => @username } if @gitaly && @gitaly.include?('token') |
