summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab_access_status.rb12
-rw-r--r--lib/gitlab_net.rb2
-rw-r--r--lib/gitlab_shell.rb7
3 files changed, 16 insertions, 5 deletions
diff --git a/lib/gitlab_access_status.rb b/lib/gitlab_access_status.rb
index a6a274c..494349d 100644
--- a/lib/gitlab_access_status.rb
+++ b/lib/gitlab_access_status.rb
@@ -1,19 +1,25 @@
require 'json'
class GitAccessStatus
- attr_reader :message, :gl_repository, :repository_path, :gitaly
+ attr_reader :message, :gl_repository, :repository_path, :gitaly, :geo_node
- def initialize(status, message, gl_repository, repository_path, gitaly)
+ def initialize(status, message, gl_repository, repository_path, gitaly, geo_node)
@status = status
@message = message
@gl_repository = gl_repository
@repository_path = repository_path
@gitaly = gitaly
+ @geo_node = geo_node
end
def self.create_from_json(json)
values = JSON.parse(json)
- self.new(values["status"], values["message"], values["gl_repository"], values["repository_path"], values["gitaly"])
+ self.new(values["status"],
+ values["message"],
+ values["gl_repository"],
+ values["repository_path"],
+ values["gitaly"],
+ values["geo_node"])
end
def allowed?
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index 4c938b1..1a6c016 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -39,7 +39,7 @@ class GitlabNet
if resp.code == '200'
GitAccessStatus.create_from_json(resp.body)
else
- GitAccessStatus.new(false, 'API is not accessible', nil, nil)
+ GitAccessStatus.new(false, 'API is not accessible', nil, nil, nil, false)
end
end
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index 262f9f7..e3025ef 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -17,7 +17,7 @@ class GitlabShell
API_COMMANDS = %w(2fa_recovery_codes)
GL_PROTOCOL = 'ssh'.freeze
- attr_accessor :key_id, :gl_repository, :repo_name, :command, :git_access
+ attr_accessor :key_id, :gl_repository, :repo_name, :command, :git_access, :show_all_refs
attr_reader :repo_path
def initialize(key_id)
@@ -100,6 +100,7 @@ class GitlabShell
self.repo_path = status.repository_path
@gl_repository = status.gl_repository
@gitaly = status.gitaly
+ @show_all_refs = status.geo_node
end
def process_cmd(args)
@@ -159,6 +160,10 @@ class GitlabShell
env['GITALY_TOKEN'] = @gitaly['token']
end
+ # We have to use a negative transfer.hideRefs since this is the only way
+ # to undo an already set parameter: https://www.spinics.net/lists/git/msg256772.html
+ env['GIT_CONFIG_PARAMETERS'] = "'transfer.hideRefs=!refs'" if @show_all_refs
+
if git_trace_available?
env.merge!({
'GIT_TRACE' => @config.git_trace_log_file,