lib/bundler/definition.rb in bundler-1.10.4 vs lib/bundler/definition.rb in bundler-1.10.5

- old
+ new

@@ -246,24 +246,25 @@ # Convert to \r\n if the existing lock has them # i.e., Windows with `git config core.autocrlf=true` contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n") - return if lockfiles_equal?(@lockfile_contents, contents, preserve_bundled_with) - - if Bundler.settings[:frozen] - Bundler.ui.error "Cannot write a changed lockfile while frozen." - return - end - if @locked_bundler_version locked_major = @locked_bundler_version.segments.first current_major = Gem::Version.create(Bundler::VERSION).segments.first - if locked_major < current_major - Bundler.ui.warn "Warning: the lockfile is being updated to Bundler #{Bundler::VERSION.split('.').first}, " \ + if updating_major = locked_major < current_major + Bundler.ui.warn "Warning: the lockfile is being updated to Bundler #{current_major}, " \ "after which you will be unable to return to Bundler #{@locked_bundler_version.segments.first}." end + end + + preserve_bundled_with ||= !updating_major && (Bundler.settings[:frozen] || !@unlocking) + return if lockfiles_equal?(@lockfile_contents, contents, preserve_bundled_with) + + if Bundler.settings[:frozen] + Bundler.ui.error "Cannot write a changed lockfile while frozen." + return end File.open(file, 'wb'){|f| f.puts(contents) } rescue Errno::EACCES raise Bundler::InstallError,