diff options
| author | Bundlerbot <bot@bundler.io> | 2019-04-24 11:58:40 +0000 |
|---|---|---|
| committer | Bundlerbot <bot@bundler.io> | 2019-04-24 11:58:40 +0000 |
| commit | ec8f98574a90de1e87a50e00141180d761f161dc (patch) | |
| tree | 1b9e8c22bda415035ef8ed010191eb0897790fe5 /lib | |
| parent | dea7c6dcc3658d4f7ffcebdd7147076b017dc8db (diff) | |
| parent | 6df7af763cb3d8b13568ca12199ca778cccbe405 (diff) | |
| download | bundler-ec8f98574a90de1e87a50e00141180d761f161dc.tar.gz | |
Merge #6329
6329: Stop printing “failed to update” message when changing sources r=segiddins a=segiddins
### What was the end-user problem that led to this PR?
The problem was `bundle update` shows incorrect message when updating git gems
Closes #6325
### What was your diagnosis of the problem?
My diagnosis was we need to check if the source has changed
### What is your fix for the problem, implemented in this PR?
My fix only prints the message when the source has not changed
Note that is does not yet fix the "updated the git sha" case, since the locked spec and the new spec actually share the same source object!
Co-authored-by: Samuel Giddins <segiddins@segiddins.me>
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/bundler/cli/update.rb | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index 13d71bb50e..45d0374eef 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -58,6 +58,14 @@ module Bundler Bundler.settings.set_command_option_if_given :jobs, opts["jobs"] Bundler.definition.validate_runtime! + + if locked_gems = Bundler.definition.locked_gems + previous_locked_specs = locked_gems.specs.reduce({}) do |h, s| + h[s.name] = { :version => s.version, :source => s.source.to_s } + h + end + end + installer = Installer.install Bundler.root, Bundler.definition, opts Bundler.load.cache if Bundler.app_cache.exist? @@ -66,13 +74,16 @@ module Bundler Bundler::CLI::Clean.new(options).run end - if locked_gems = Bundler.definition.locked_gems + if locked_gems gems.each do |name| - locked_version = locked_gems.specs.find {|s| s.name == name } - locked_version &&= locked_version.version - next unless locked_version - new_version = Bundler.definition.specs[name].first - new_version &&= new_version.version + locked_spec = previous_locked_specs[name] + next unless locked_spec + locked_source = locked_spec[:source] + locked_version = locked_spec[:version] + new_spec = Bundler.definition.specs[name].first + new_source = new_spec.source.to_s + new_version = new_spec.version + next if locked_source != new_source if !new_version Bundler.ui.warn "Bundler attempted to update #{name} but it was removed from the bundle" elsif new_version < locked_version |
