Skip to content

Commit

Permalink
Treat .bundlecache files as binary
Browse files Browse the repository at this point in the history
The `.bundlecache` file is an empty file that bundler puts in a git
dependencies `vendor/cache/<gem>` folder, to indicate that the file does
not need to be re-downloaded, see:

https://github.com/rubygems/bundler/blob/6394536271a0326efd4ed3544b78e528da7e90b1/lib/bundler/plugin/api/source.rb#L175-L192

Empty files without an extension are treated as binary files by the
`file` util. This is not problematic for submitting to the GitHub API,
since it ends up simply base64 encoding (and subsequently decoding in
GitHub) an empty string.
  • Loading branch information
jurre committed Oct 12, 2020
1 parent 6bbc7be commit 5282864
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions bundler/spec/dependabot/bundler/file_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,7 @@
it "does not base64 encode vendored code" do
updater.updated_dependency_files.
select { |f| f.name.start_with?(added) }.
reject { |f| f.name.end_with?(".bundlecache") }.
each { |f| expect(f.content_encoding).to eq("") }
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
describe "binary encoding" do
let(:project_name) { "binary_files" }

%w(test.zip test_bin test.png test.gem).each do |name|
%w(test.zip test_bin test.png test.gem .bundlecache).each do |name|
it "marks #{name} files correctly" do
in_cloned_repository(repo_contents_path) do
`mv vendor/cache/#{name} vendor/cache/new_#{name}`
Expand Down
Empty file.

0 comments on commit 5282864

Please sign in to comment.