diff options
Diffstat (limited to 'lib/rubygems/source/git.rb')
-rw-r--r-- | lib/rubygems/source/git.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb index 2609a309e8..bda63c6844 100644 --- a/lib/rubygems/source/git.rb +++ b/lib/rubygems/source/git.rb @@ -53,7 +53,7 @@ class Gem::Source::Git < Gem::Source @uri = Gem::Uri.parse(repository) @name = name @repository = repository - @reference = reference + @reference = reference || "HEAD" @need_submodules = submodules @remote = true @@ -70,8 +70,6 @@ class Gem::Source::Git < Gem::Source -1 when Gem::Source then 1 - else - nil end end @@ -223,14 +221,14 @@ class Gem::Source::Git < Gem::Source end ## - # A hash for the git gem based on the git repository URI. + # A hash for the git gem based on the git repository Gem::URI. def uri_hash # :nodoc: require_relative "../openssl" normalized = - if @repository =~ %r{^\w+://(\w+@)?} - uri = URI(@repository).normalize.to_s.sub %r{/$},"" + if @repository.match?(%r{^\w+://(\w+@)?}) + uri = Gem::URI(@repository).normalize.to_s.sub %r{/$},"" uri.sub(/\A(\w+)/) { $1.downcase } else @repository |