diff options
author | The Bundler Bot <bot@bundler.io> | 2017-04-22 03:42:37 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-04-22 03:42:37 +0000 |
commit | 334b901de575ca4b6b88e164106e2a52f4f4bff9 (patch) | |
tree | 6ccf6ac5181bb395d3cdda75f8d3ff5399072232 /spec | |
parent | f441bc85855b4778f80989f17cf7ae3a55a2d766 (diff) | |
parent | 9be3a304359cd81956c14f33ab905084a128d866 (diff) | |
download | bundler-334b901de575ca4b6b88e164106e2a52f4f4bff9.tar.gz |
Auto merge of #5602 - alextaylor000:issue-5423, r=segiddins
Ensure pre-existing Git caches are updated from remote sources
This will be my first contribution to Bundler. Thanks for the amazing dev setup guides!
This fixes issue #5423 where Git sources would not be updated if they were already cached in `vendor/cache`.
When we build a Git source from Gemfile.lock, we store the revision listed in the lockfile. However, when unlocking the source for an update, we don't clear that revision, and the update proceeds to grab the stale version from `vendor/cache`. Interestingly, this behaviour only occurs when updating a specific gem, i.e. `bundle update timecop`. This bug isn't present when doing a global `bundle update`, possibly because of the differences in how we build up the Definition between the two methods.
Closes #5423.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/cache/git_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb index b256c8d90f..31b3816a3b 100644 --- a/spec/cache/git_spec.rb +++ b/spec/cache/git_spec.rb @@ -93,6 +93,33 @@ end expect(out).to eq("CACHE") end + it "tracks updates when specifying the gem" do + git = build_git "foo" + old_ref = git.ref_for("master", 11) + + install_gemfile <<-G + gem "foo", :git => '#{lib_path("foo-1.0")}' + G + + bundle "#{cmd} --all" + + update_git "foo" do |s| + s.write "lib/foo.rb", "puts :CACHE" + end + + ref = git.ref_for("master", 11) + expect(ref).not_to eq(old_ref) + + bundle "update foo" + + expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist + expect(bundled_app("vendor/cache/foo-1.0-#{old_ref}")).not_to exist + + FileUtils.rm_rf lib_path("foo-1.0") + run "require 'foo'" + expect(out).to eq("CACHE") + end + it "uses the local repository to generate the cache" do git = build_git "foo" ref = git.ref_for("master", 11) |