aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/source.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/source.rb')
-rw-r--r--lib/rubygems/source.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb
index 85f5268fa3..4f07beb1f4 100644
--- a/lib/rubygems/source.rb
+++ b/lib/rubygems/source.rb
@@ -67,7 +67,11 @@ class Gem::Source
return -1 if !other.uri
- @uri.to_s <=> other.uri.to_s
+ # Returning 1 here ensures that when sorting a list of sources, the
+ # original ordering of sources supplied by the user is preserved.
+ return 1 unless @uri.to_s == other.uri.to_s
+
+ 0
else
nil
end