bin/overcommit in overcommit-0.39.1 vs bin/overcommit in overcommit-0.40.0

- old
+ new

@@ -1,10 +1,9 @@ #!/usr/bin/env ruby # Check if Overcommit should invoke a Bundler context for loading gems require 'yaml' -# rubocop:disable Style/RescueModifier if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil ENV['BUNDLE_GEMFILE'] = gemfile require 'bundler' begin @@ -20,12 +19,17 @@ end rescue Bundler::BundlerError => ex puts "Problem loading '#{gemfile}': #{ex.message}" puts "Try running:\nbundle install --gemfile=#{gemfile}" if ex.is_a?(Bundler::GemNotFound) exit 78 # EX_CONFIG + rescue Gem::LoadError => ex + # Handle case where user is executing overcommit without `bundle exec` and + # whose local Gemfile has a gem requirement that does not match a gem + # requirement of the installed version of Overcommit. + raise unless ex.message =~ /already activated/i + exec('bundle', 'exec', $0, *ARGV) end end -# rubocop:enable Style/RescueModifier begin require 'overcommit/cli' rescue LoadError if gemfile