summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-08-01 14:50:26 +0000
committerNick Thomas <nick@gitlab.com>2018-08-01 14:50:26 +0000
commit5c15800283feec3122f89d93254743ae5f95bb25 (patch)
treee4e67ff81c5962ada99e2f09bf2e48596b2ff795 /lib
parente3fead94b6f71d3501d586cbb2295ea0d1da2b31 (diff)
parent66e00351605afd524c1ac8df7fcd0690bd074747 (diff)
downloadgitlab-shell-5c15800283feec3122f89d93254743ae5f95bb25.tar.gz
Merge branch 'add-protocol-v2-logic' into 'master'
Add Git protocol v2 See merge request gitlab-org/gitlab-shell!217
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab_access_status.rb8
-rw-r--r--lib/gitlab_net.rb3
-rw-r--r--lib/gitlab_shell.rb6
3 files changed, 11 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..78fdfe8 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 = ENV['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)]