diff options
author | Stan Hu <stanhu@gmail.com> | 2017-08-06 21:46:38 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-08-06 21:51:42 -0700 |
commit | 5687bd24844b5a244b4888ae0f9e26c13aea720e (patch) | |
tree | 77f4ad2fe556b762845870d14de3c262f56cdb5c /lib/gitlab_shell.rb | |
parent | 20896b6477be40d826b3aa391ff55698974cca61 (diff) | |
download | gitlab-shell-sh-fix-git-upload-pack.tar.gz |
Fix SSH support for Git for Windows v2.14sh-fix-git-upload-pack
Git For Windows 2.14 has a patch that changes `git-upload-pack` to `git upload-pack`.
To make this work for gitlab-shell, just map this to `git-upload-pack`.
Closes gitlab-org/gitlab-ce#36028
Diffstat (limited to 'lib/gitlab_shell.rb')
-rw-r--r-- | lib/gitlab_shell.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb index fbbc0da..243c629 100644 --- a/lib/gitlab_shell.rb +++ b/lib/gitlab_shell.rb @@ -38,7 +38,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 } @@ -70,10 +70,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) @@ -93,6 +100,8 @@ class GitlabShell raise DisallowedCommandError unless args.count == 2 @repo_name = args.last end + + args end def verify_access |