Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rubygems#6157 - mattbrictson:fix-nomethoderror-bundle-u…
…pdate-group, r=indirect Fix NoMethodError during `bundle update --group` ### What was the end-user problem that led to this PR? rubygems#6156: NoMethodError: undefined method `version' for nil:NilClass ### What was your diagnosis of the problem? The `bundler` gem does not participate in the lockfile, but it can still be included in the list of dependencies that are being updated by `bundle update` if `--group` is specified. For example, if a Gemfile contains `bundler-audit` (which depends on `bundler`) in the `:development` group, then updating with the option `--group=development` will naturally include `bundler` in the list of gems to evaluate for updating. The trouble is that since `bundler` is excluded from the lockfile, searching the locked gems for a gemspec for bundler will return `nil`. This caused the following error during `bundle update`: NoMethodError: undefined method `version' for nil:NilClass ### What is your fix for the problem, implemented in this PR? This PR solves this bug by skipping over gems (i.e `bundler`) that are not in the lockfile when comparing gem versions at the conclusion of the upgrade command. Fixes rubygems#6156. ### Why did you choose this fix out of the possible options? I chose this fix because the bug seems to have been introduced by 618c09b. My fix takes place within the new feature that was added in that commit, so it seems safe and unlikely to have side-effects.
- Loading branch information