lib/bundler/source.rb in bundler-1.0.14 vs lib/bundler/source.rb in bundler-1.0.15
- old
+ new
@@ -606,14 +606,20 @@
input = uri
end
Digest::SHA1.hexdigest(input)
end
- # Escape the URI for shell commands. To support a single quote
- # within the URI we must end the string, escape the quote and
- # restart.
+ # Escape the URI for git commands
def uri_escaped
- "'#{uri.gsub("'") {|s| "'\\''"}}'"
+ if Bundler::WINDOWS
+ # Windows quoting requires double quotes only, with double quotes
+ # inside the string escaped by being doubled.
+ '"' + uri.gsub('"') {|s| '""'} + '"'
+ else
+ # Bash requires single quoted strings, with the single quotes escaped
+ # by ending the string, escaping the quote, and restarting the string.
+ "'" + uri.gsub("'") {|s| "'\\''"} + "'"
+ end
end
def cache_path
@cache_path ||= begin
git_scope = "#{base_name}-#{uri_hash}"