Skip to content

Commit 482a39a

Browse files
committed
Revert "Best to escape strings not split them"
This reverts commit aca7f56.
1 parent c27e49e commit 482a39a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lib/gitlab/backend/shell.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AccessDenied < StandardError; end
1212
# add_repository("gitlab/gitlab-ci")
1313
#
1414
def add_repository(name)
15-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", Shellwords.shellescape("#{name}.git")
15+
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "add-project", Shellwords.shellwords("#{name}.git")
1616
end
1717

1818
# Import repository
@@ -23,7 +23,7 @@ def add_repository(name)
2323
# import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git")
2424
#
2525
def import_repository(name, url)
26-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", Shellwords.shellescape("#{name}.git"), Shellwords.shellescape(url)
26+
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "import-project", Shellwords.shellwords("#{name}.git"), Shellwords.shellwords(url)
2727
end
2828

2929
# Move repository
@@ -35,7 +35,7 @@ def import_repository(name, url)
3535
# mv_repository("gitlab/gitlab-ci", "randx/gitlab-ci-new.git")
3636
#
3737
def mv_repository(path, new_path)
38-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape("#{new_path}.git")
38+
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "mv-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords("#{new_path}.git")
3939
end
4040

4141
# Update HEAD for repository
@@ -47,7 +47,7 @@ def mv_repository(path, new_path)
4747
# update_repository_head("gitlab/gitlab-ci", "3-1-stable")
4848
#
4949
def update_repository_head(path, branch)
50-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(branch)
50+
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "update-head", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch)
5151
end
5252

5353
# Fork repository to new namespace
@@ -59,18 +59,18 @@ def update_repository_head(path, branch)
5959
# fork_repository("gitlab/gitlab-ci", "randx")
6060
#
6161
def fork_repository(path, fork_namespace)
62-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(fork_namespace)
62+
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "fork-project", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(fork_namespace)
6363
end
6464

6565
# Remove repository from file system
6666
#
67-
# path - project path with namespace
67+
# name - project path with namespace
6868
#
6969
# Ex.
7070
# remove_repository("gitlab/gitlab-ci")
7171
#
72-
def remove_repository(path)
73-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", Shellwords.shellescape("#{path}.git")
72+
def remove_repository(name)
73+
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", Shellwords.shellwords("#{name}.git")
7474
end
7575

7676
# Add repository branch from passed ref
@@ -83,7 +83,7 @@ def remove_repository(path)
8383
# add_branch("gitlab/gitlab-ci", "4-0-stable", "master")
8484
#
8585
def add_branch(path, branch_name, ref)
86-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(branch_name), Shellwords.shellescape(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)
8787
end
8888

8989
# Remove repository branch
@@ -95,7 +95,7 @@ def add_branch(path, branch_name, ref)
9595
# rm_branch("gitlab/gitlab-ci", "4-0-stable")
9696
#
9797
def rm_branch(path, branch_name)
98-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(branch_name)
98+
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(branch_name)
9999
end
100100

101101
# Add repository tag from passed ref
@@ -108,7 +108,7 @@ def rm_branch(path, branch_name)
108108
# add_tag("gitlab/gitlab-ci", "v4.0", "master")
109109
#
110110
def add_tag(path, tag_name, ref)
111-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-tag", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(tag_name), Shellwords.shellescape(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)
112112
end
113113

114114
# Remove repository tag
@@ -120,7 +120,7 @@ def add_tag(path, tag_name, ref)
120120
# rm_tag("gitlab/gitlab-ci", "v4.0")
121121
#
122122
def rm_tag(path, tag_name)
123-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", Shellwords.shellescape("#{path}.git"), Shellwords.shellescape(tag_name)
123+
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-tag", Shellwords.shellwords("#{path}.git"), Shellwords.shellwords(tag_name)
124124
end
125125

126126
# Add new key to gitlab-shell
@@ -129,7 +129,7 @@ def rm_tag(path, tag_name)
129129
# add_key("key-42", "sha-rsa ...")
130130
#
131131
def add_key(key_id, key_content)
132-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", Shellwords.shellescape(key_id), Shellwords.shellescape(key_content)
132+
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "add-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content)
133133
end
134134

135135
# Remove ssh key from gitlab shell
@@ -138,7 +138,7 @@ def add_key(key_id, key_content)
138138
# remove_key("key-342", "sha-rsa ...")
139139
#
140140
def remove_key(key_id, key_content)
141-
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", Shellwords.shellescape(key_id), Shellwords.shellescape(key_content)
141+
system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys", "rm-key", Shellwords.shellwords(key_id), Shellwords.shellwords(key_content)
142142
end
143143

144144
# Remove all ssh keys from gitlab shell

0 commit comments

Comments
 (0)