From f5591f68c1439eda836460e0dec44f610709a5b8 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 21 Jul 2017 12:35:26 -0700 Subject: Support unhiding of all refs for Geo Nodes By default, we hide certain refs (e.g. keep-around/XXX) to save user download time. We need to preserve these references on secondary Geo nodes to have a true copy. --- spec/gitlab_shell_spec.rb | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'spec/gitlab_shell_spec.rb') diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb index 29093ac..7908b09 100644 --- a/spec/gitlab_shell_spec.rb +++ b/spec/gitlab_shell_spec.rb @@ -19,12 +19,12 @@ describe GitlabShell do end end - let(:gitaly_check_access) { GitAccessStatus.new(true, 'ok', gl_repository, repo_path, { 'repository' => { 'relative_path' => repo_name, 'storage_name' => 'default'} , 'address' => 'unix:gitaly.socket' })} + let(:gitaly_check_access) { GitAccessStatus.new(true, 'ok', gl_repository, repo_path, { 'repository' => { 'relative_path' => repo_name, 'storage_name' => 'default'} , 'address' => 'unix:gitaly.socket' }, false) } let(:api) do double(GitlabNet).tap do |api| api.stub(discover: { 'name' => 'John Doe' }) - api.stub(check_access: GitAccessStatus.new(true, 'ok', gl_repository, repo_path, nil)) + api.stub(check_access: GitAccessStatus.new(true, 'ok', gl_repository, repo_path, nil, false)) api.stub(two_factor_recovery_codes: { 'success' => true, 'recovery_codes' => ['f67c514de60c4953', '41278385fc00c1e0'] @@ -326,7 +326,7 @@ describe GitlabShell do end it "should disallow access and log the attempt if check_access returns false status" do - api.stub(check_access: GitAccessStatus.new(false, 'denied', nil, nil, nil)) + api.stub(check_access: GitAccessStatus.new(false, 'denied', nil, nil, nil, false)) message = "gitlab-shell: Access denied for git command " message << "by user with key #{key_id}." $logger.should_receive(:warn).with(message) @@ -386,6 +386,20 @@ describe GitlabShell do shell.send :exec_cmd, [1, 2] end + context "when show_all_refs is enabled" do + before { shell.show_all_refs = true } + + it 'sets local git parameters' do + expected_hash = hash_including( + 'GIT_CONFIG_PARAMETERS' => "'transfer.hideRefs=!refs'" + ) + + Kernel.should_receive(:exec).with(expected_hash, [1, 2], exec_options).once + + shell.send :exec_cmd, [1, 2] + end + end + context "when specifying a git_tracing log file" do let(:git_trace_log_file) { '/tmp/git_trace_performance.log' } -- cgit v1.2.1