summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-08-07 17:10:01 +0000
committerRobert Speicher <robert@gitlab.com>2017-08-07 17:10:01 +0000
commita50c1ccf4a7016258c5af4562bf924e389da4d07 (patch)
treebb50cd2df3ec22c4e2060d4afc01e93a84ad6311
parent5f1ab2100c2e520785a46da6d759685a65849d51 (diff)
parent21461ce3878eb456e4b7c3ebb6b4476f68a9acdf (diff)
downloadgitlab-shell-a50c1ccf4a7016258c5af4562bf924e389da4d07.tar.gz
Merge branch 'fix-git-2.14-for-windows' into '5-3-stable'
Backport fix for Git 2.14 for Windows to 5-3-stable See merge request !160
-rw-r--r--lib/gitlab_shell.rb15
-rw-r--r--spec/gitlab_shell_spec.rb12
2 files changed, 22 insertions, 5 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index 262f9f7..bbc53a5 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -35,7 +35,7 @@ class GitlabShell
end
args = Shellwords.shellwords(origin_cmd)
- parse_cmd(args)
+ args = parse_cmd(args)
if GIT_COMMANDS.include?(args.first)
GitlabMetrics.measure('verify-access') { verify_access }
@@ -67,10 +67,17 @@ class GitlabShell
protected
def parse_cmd(args)
- @command = args.first
+ # Handle Git for Windows 2.14 using "git upload-pack" instead of git-upload-pack
+ if args.length == 3 && args.first == 'git'
+ @command = "git-#{args[1]}"
+ args = [@command, args.last]
+ else
+ @command = args.first
+ end
+
@git_access = @command
- return if API_COMMANDS.include?(@command)
+ return args if API_COMMANDS.include?(@command)
raise DisallowedCommandError unless GIT_COMMANDS.include?(@command)
@@ -90,6 +97,8 @@ class GitlabShell
raise DisallowedCommandError unless args.count == 2
@repo_name = args.last
end
+
+ args
end
def verify_access
diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb
index 29093ac..d4a30e8 100644
--- a/spec/gitlab_shell_spec.rb
+++ b/spec/gitlab_shell_spec.rb
@@ -132,8 +132,8 @@ describe GitlabShell do
describe :exec do
let(:gitaly_message) { JSON.dump({ 'repository' => { 'relative_path' => repo_name, 'storage_name' => 'default' }, 'gl_repository' => gl_repository , 'gl_id' => key_id}) }
- context 'git-upload-pack' do
- let(:ssh_cmd) { "git-upload-pack gitlab-ci.git" }
+ shared_examples_for 'upload-pack' do |command|
+ let(:ssh_cmd) { "#{command} gitlab-ci.git" }
after { subject.exec(ssh_cmd) }
it "should process the command" do
@@ -157,6 +157,14 @@ describe GitlabShell do
end
end
+ context 'git-upload-pack' do
+ it_behaves_like 'upload-pack', 'git-upload-pack'
+ end
+
+ context 'git upload-pack' do
+ it_behaves_like 'upload-pack', 'git upload-pack'
+ end
+
context 'gitaly-upload-pack' do
let(:ssh_cmd) { "git-upload-pack gitlab-ci.git" }
before {