diff options
author | Andre Arko <website+github.com@arko.net> | 2011-05-23 09:09:16 -0700 |
---|---|---|
committer | Andre Arko <website+github.com@arko.net> | 2011-05-23 09:09:16 -0700 |
commit | 7f3f7e9eea8c8931b6b1d4318614789bc9a08d5e (patch) | |
tree | fc651333be899d04e4264f1dfb8779e2e6c43c96 /lib | |
parent | b785604a50b56188de88066c7a530aa76100adf0 (diff) | |
parent | 4fc8385c4394680cc597b62d92ae9cecf0e62cdf (diff) | |
download | bundler-7f3f7e9eea8c8931b6b1d4318614789bc9a08d5e.tar.gz |
Merge pull request #1190 from mheffner/single_quote_uri
Switch double->single quotes in git repo URI
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/source.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index aa96a547..7fd04864 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -602,6 +602,13 @@ module Bundler 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. + def uri_escaped + "'#{uri.gsub("'") {|s| "'\\''"}}'" + end + def cache_path @cache_path ||= begin git_scope = "#{base_name}-#{uri_hash}" @@ -619,12 +626,12 @@ module Bundler return if has_revision_cached? Bundler.ui.info "Updating #{uri}" in_cache do - git %|fetch --force --quiet --tags "#{uri}" "refs/heads/*:refs/heads/*"| + git %|fetch --force --quiet --tags #{uri_escaped} "refs/heads/*:refs/heads/*"| end else Bundler.ui.info "Fetching #{uri}" FileUtils.mkdir_p(cache_path.dirname) - git %|clone "#{uri}" "#{cache_path}" --bare --no-hardlinks| + git %|clone #{uri_escaped} "#{cache_path}" --bare --no-hardlinks| end end |