Skip to content

Commit 52966ab

Browse files
committed
Include prerelease gems in compact index during incremental update
In `update_index`, the call to `update_compact_index` only received `released` specs, excluding prerelease gems from the compact index files (`versions`, `info/<gemname>`). Since modern Bundler prefers the compact index, prerelease gems were effectively invisible after an incremental `--update`. Fix by passing all specs (both released and prerelease) to `update_compact_index`. Fixes #48
1 parent 61a8570 commit 52966ab

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

lib/rubygems/indexer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def update_index
450450

451451
if @build_compact
452452
Gem.time "Updated compact index files" do
453-
files += update_compact_index released, @dest_directory, @directory
453+
files += update_compact_index specs, @dest_directory, @directory
454454
end
455455
end
456456

test/rubygems/test_gem_indexer.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,14 @@ def test_update_index
459459
1 |checksum:#{file_sha256(File.join(gems, "e-1.gem"))}
460460
INFO_FILE
461461

462-
assert_equal <<~INFO_FILE, File.read(File.join(infodir, "d"))
463-
#{info_d_file.chomp}
464-
2.1 |checksum:#{file_sha256(File.join(gems, "d-2.1.gem"))}
465-
INFO_FILE
462+
d_info = File.read(File.join(infodir, "d"))
463+
assert d_info.start_with?(info_d_file), "info/d should preserve original content"
464+
assert_match(/^2\.1 \|checksum:#{Regexp.escape(file_sha256(File.join(gems, "d-2.1.gem")))}$/, d_info)
465+
assert_match(/^2\.2\.a \|checksum:#{Regexp.escape(file_sha256(File.join(gems, "d-2.2.a.gem")))}/, d_info)
466466

467467
assert_equal <<~VERSIONS_FILE, File.read(File.join(@indexerdir, "versions"))
468468
#{versions_file.chomp}
469-
d 2.1 #{file_md5(File.join(@indexerdir, "info", "d"))}
469+
d 2.1,2.2.a #{file_md5(File.join(@indexerdir, "info", "d"))}
470470
e 1 #{file_md5(File.join(@indexerdir, "info", "e"))}
471471
VERSIONS_FILE
472472

0 commit comments

Comments
 (0)