Commit 33b041a346795b80d48ed1b200227d0ab4c4bcca
1 parent
9f9d9cff
Revert "Escape strings"
This reverts commit 03141bfccca2b61721a12f3bb17eb6308cfb0ec4.
Showing
1 changed file
with
12 additions
and
14 deletions
Show diff stats
lib/gitlab/backend/shell.rb
1 | -require "shellwords" | ||
2 | - | ||
3 | module Gitlab | 1 | module Gitlab |
4 | class Shell | 2 | class Shell |
5 | class AccessDenied < StandardError; end | 3 | class AccessDenied < StandardError; end |
@@ -12,7 +10,7 @@ module Gitlab | @@ -12,7 +10,7 @@ module Gitlab | ||
12 | # add_repository("gitlab/gitlab-ci") | 10 | # add_repository("gitlab/gitlab-ci") |
13 | # | 11 | # |
14 | def add_repository(name) | 12 | def add_repository(name) |
15 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", Shellwords.shellwords("#{name}.git") | 13 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", "#{name}.git" |
16 | end | 14 | end |
17 | 15 | ||
18 | # Import repository | 16 | # Import repository |
@@ -23,7 +21,7 @@ module Gitlab | @@ -23,7 +21,7 @@ module Gitlab | ||
23 | # import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git") | 21 | # import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git") |
24 | # | 22 | # |
25 | def import_repository(name, url) | 23 | def import_repository(name, url) |
26 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", Shellwords.shellwords("#{name}.git"), Shellwords.shellwords(url) | 24 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", "#{name}.git", url |
27 | end | 25 | end |
28 | 26 | ||
29 | # Move repository | 27 | # Move repository |
@@ -35,7 +33,7 @@ module Gitlab | @@ -35,7 +33,7 @@ module Gitlab | ||
35 | # mv_repository("gitlab/gitlab-ci", "randx/gitlab-ci-new.git") | 33 | # mv_repository("gitlab/gitlab-ci", "randx/gitlab-ci-new.git") |
36 | # | 34 | # |
37 | def mv_repository(path, new_path) | 35 | def mv_repository(path, new_path) |
38 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords("#{new_path}.git") | 36 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", "#{path}.git", "#{new_path}.git" |
39 | end | 37 | end |
40 | 38 | ||
41 | # Update HEAD for repository | 39 | # Update HEAD for repository |
@@ -47,7 +45,7 @@ module Gitlab | @@ -47,7 +45,7 @@ module Gitlab | ||
47 | # update_repository_head("gitlab/gitlab-ci", "3-1-stable") | 45 | # update_repository_head("gitlab/gitlab-ci", "3-1-stable") |
48 | # | 46 | # |
49 | def update_repository_head(path, branch) | 47 | def update_repository_head(path, branch) |
50 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch) | 48 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", "#{path}.git", branch |
51 | end | 49 | end |
52 | 50 | ||
53 | # Fork repository to new namespace | 51 | # Fork repository to new namespace |
@@ -59,7 +57,7 @@ module Gitlab | @@ -59,7 +57,7 @@ module Gitlab | ||
59 | # fork_repository("gitlab/gitlab-ci", "randx") | 57 | # fork_repository("gitlab/gitlab-ci", "randx") |
60 | # | 58 | # |
61 | def fork_repository(path, fork_namespace) | 59 | def fork_repository(path, fork_namespace) |
62 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(fork_namespace) | 60 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", "#{path}.git", fork_namespace |
63 | end | 61 | end |
64 | 62 | ||
65 | # Remove repository from file system | 63 | # Remove repository from file system |
@@ -70,7 +68,7 @@ module Gitlab | @@ -70,7 +68,7 @@ module Gitlab | ||
70 | # remove_repository("gitlab/gitlab-ci") | 68 | # remove_repository("gitlab/gitlab-ci") |
71 | # | 69 | # |
72 | def remove_repository(name) | 70 | def remove_repository(name) |
73 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", Shellwords.shellwords("#{name}.git") | 71 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", "#{name}.git" |
74 | end | 72 | end |
75 | 73 | ||
76 | # Add repository branch from passed ref | 74 | # Add repository branch from passed ref |
@@ -83,7 +81,7 @@ module Gitlab | @@ -83,7 +81,7 @@ module Gitlab | ||
83 | # add_branch("gitlab/gitlab-ci", "4-0-stable", "master") | 81 | # add_branch("gitlab/gitlab-ci", "4-0-stable", "master") |
84 | # | 82 | # |
85 | def add_branch(path, branch_name, ref) | 83 | def add_branch(path, branch_name, ref) |
86 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch_name), Shellwords.shellwords(ref) | 84 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", "#{path}.git", branch_name, ref |
87 | end | 85 | end |
88 | 86 | ||
89 | # Remove repository branch | 87 | # Remove repository branch |
@@ -95,7 +93,7 @@ module Gitlab | @@ -95,7 +93,7 @@ module Gitlab | ||
95 | # rm_branch("gitlab/gitlab-ci", "4-0-stable") | 93 | # rm_branch("gitlab/gitlab-ci", "4-0-stable") |
96 | # | 94 | # |
97 | def rm_branch(path, branch_name) | 95 | def rm_branch(path, branch_name) |
98 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch_name) | 96 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", "#{path}.git", branch_name |
99 | end | 97 | end |
100 | 98 | ||
101 | # Add repository tag from passed ref | 99 | # Add repository tag from passed ref |
@@ -108,7 +106,7 @@ module Gitlab | @@ -108,7 +106,7 @@ module Gitlab | ||
108 | # add_tag("gitlab/gitlab-ci", "v4.0", "master") | 106 | # add_tag("gitlab/gitlab-ci", "v4.0", "master") |
109 | # | 107 | # |
110 | def add_tag(path, tag_name, ref) | 108 | def add_tag(path, tag_name, ref) |
111 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(tag_name), Shellwords.shellwords(ref) | 109 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", "#{path}.git", tag_name, ref |
112 | end | 110 | end |
113 | 111 | ||
114 | # Remove repository tag | 112 | # Remove repository tag |
@@ -120,7 +118,7 @@ module Gitlab | @@ -120,7 +118,7 @@ module Gitlab | ||
120 | # rm_tag("gitlab/gitlab-ci", "v4.0") | 118 | # rm_tag("gitlab/gitlab-ci", "v4.0") |
121 | # | 119 | # |
122 | def rm_tag(path, tag_name) | 120 | def rm_tag(path, tag_name) |
123 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(tag_name) | 121 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", "#{path}.git", tag_name |
124 | end | 122 | end |
125 | 123 | ||
126 | # Add new key to gitlab-shell | 124 | # Add new key to gitlab-shell |
@@ -129,7 +127,7 @@ module Gitlab | @@ -129,7 +127,7 @@ module Gitlab | ||
129 | # add_key("key-42", "sha-rsa ...") | 127 | # add_key("key-42", "sha-rsa ...") |
130 | # | 128 | # |
131 | def add_key(key_id, key_content) | 129 | def add_key(key_id, key_content) |
132 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content) | 130 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", key_id, key_content |
133 | end | 131 | end |
134 | 132 | ||
135 | # Remove ssh key from gitlab shell | 133 | # Remove ssh key from gitlab shell |
@@ -138,7 +136,7 @@ module Gitlab | @@ -138,7 +136,7 @@ module Gitlab | ||
138 | # remove_key("key-342", "sha-rsa ...") | 136 | # remove_key("key-342", "sha-rsa ...") |
139 | # | 137 | # |
140 | def remove_key(key_id, key_content) | 138 | def remove_key(key_id, key_content) |
141 | - system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content) | 139 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", key_id, key_content |
142 | end | 140 | end |
143 | 141 | ||
144 | # Remove all ssh keys from gitlab shell | 142 | # Remove all ssh keys from gitlab shell |