Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/git_hosting/patches/git_adapter_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ def client_command_with_sudo
def scm_cmd_with_sudo(*args, &block)

args.each do |a|
a.gsub!(/^\.\-\w_\:]/, '')
if ! a.empty?
# http://stackoverflow.com/questions/1306680/shellwords-shellescape-implementation-for-ruby-1-8
a.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/n, "\\\\\\1")
a.gsub!(/\n/, "'\n'")
end
end
max_cache_time = (Setting.plugin_redmine_git_hosting['gitCacheMaxTime']).to_i # in seconds, default = 60
max_cache_elements = (Setting.plugin_redmine_git_hosting['gitCacheMaxElements']).to_i # default = 100
Expand All @@ -52,6 +56,7 @@ def scm_cmd_with_sudo(*args, &block)
end
full_args += args

# The shell escaping here doesn't work for some reason, that's why the code at the beginnign of the function
cmd_str=full_args.map { |e| shell_quote e.to_s }.join(' ')
out=nil
retio = nil
Expand Down