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 | 1 | module Gitlab |
4 | 2 | class Shell |
5 | 3 | class AccessDenied < StandardError; end |
... | ... | @@ -12,7 +10,7 @@ module Gitlab |
12 | 10 | # add_repository("gitlab/gitlab-ci") |
13 | 11 | # |
14 | 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 | 14 | end |
17 | 15 | |
18 | 16 | # Import repository |
... | ... | @@ -23,7 +21,7 @@ module Gitlab |
23 | 21 | # import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git") |
24 | 22 | # |
25 | 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 | 25 | end |
28 | 26 | |
29 | 27 | # Move repository |
... | ... | @@ -35,7 +33,7 @@ module Gitlab |
35 | 33 | # mv_repository("gitlab/gitlab-ci", "randx/gitlab-ci-new.git") |
36 | 34 | # |
37 | 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 | 37 | end |
40 | 38 | |
41 | 39 | # Update HEAD for repository |
... | ... | @@ -47,7 +45,7 @@ module Gitlab |
47 | 45 | # update_repository_head("gitlab/gitlab-ci", "3-1-stable") |
48 | 46 | # |
49 | 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 | 49 | end |
52 | 50 | |
53 | 51 | # Fork repository to new namespace |
... | ... | @@ -59,7 +57,7 @@ module Gitlab |
59 | 57 | # fork_repository("gitlab/gitlab-ci", "randx") |
60 | 58 | # |
61 | 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 | 61 | end |
64 | 62 | |
65 | 63 | # Remove repository from file system |
... | ... | @@ -70,7 +68,7 @@ module Gitlab |
70 | 68 | # remove_repository("gitlab/gitlab-ci") |
71 | 69 | # |
72 | 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 | 72 | end |
75 | 73 | |
76 | 74 | # Add repository branch from passed ref |
... | ... | @@ -83,7 +81,7 @@ module Gitlab |
83 | 81 | # add_branch("gitlab/gitlab-ci", "4-0-stable", "master") |
84 | 82 | # |
85 | 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 | 85 | end |
88 | 86 | |
89 | 87 | # Remove repository branch |
... | ... | @@ -95,7 +93,7 @@ module Gitlab |
95 | 93 | # rm_branch("gitlab/gitlab-ci", "4-0-stable") |
96 | 94 | # |
97 | 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 | 97 | end |
100 | 98 | |
101 | 99 | # Add repository tag from passed ref |
... | ... | @@ -108,7 +106,7 @@ module Gitlab |
108 | 106 | # add_tag("gitlab/gitlab-ci", "v4.0", "master") |
109 | 107 | # |
110 | 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 | 110 | end |
113 | 111 | |
114 | 112 | # Remove repository tag |
... | ... | @@ -120,7 +118,7 @@ module Gitlab |
120 | 118 | # rm_tag("gitlab/gitlab-ci", "v4.0") |
121 | 119 | # |
122 | 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 | 122 | end |
125 | 123 | |
126 | 124 | # Add new key to gitlab-shell |
... | ... | @@ -129,7 +127,7 @@ module Gitlab |
129 | 127 | # add_key("key-42", "sha-rsa ...") |
130 | 128 | # |
131 | 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 | 131 | end |
134 | 132 | |
135 | 133 | # Remove ssh key from gitlab shell |
... | ... | @@ -138,7 +136,7 @@ module Gitlab |
138 | 136 | # remove_key("key-342", "sha-rsa ...") |
139 | 137 | # |
140 | 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 | 140 | end |
143 | 141 | |
144 | 142 | # Remove all ssh keys from gitlab shell | ... | ... |