You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure whether should I create this issue here or on the rubygems repository (to the Bundler maintainers). Let me know what you think.
A have overcommit installed with gemfile: Gemfile option on .overcommit.yml and most (all?) of my git-hooks have this script (this was removed from .git/hooks/post-checkout):
# Check if Overcommit should invoke a Bundler context for loading gemsrequire'yaml'# rubocop:disable Style/RescueModifierifgemfile=YAML.load_file('.overcommit.yml')['gemfile']rescuenilENV['BUNDLE_GEMFILE']=gemfilerequire'bundler'beginBundler.setuprescueBundler::BundlerError=>eputs"Problem loading '#{gemfile}': #{e.message}"puts"Try running:\nbundle install --gemfile=#{gemfile}"ife.is_a?(Bundler::GemNotFound)exit78# EX_CONFIGendend# rubocop:enable Style/RescueModifier
However, on my system when I execute that, it fails on Bundler.setup. See:
$ cat Gemfile
source 'https://rubygems.org'
gem 'psych', '~> 3.0'
$ bundle install
Using bundler 2.2.25
Using psych 3.3.2
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
$ gem list | grep 'yaml\|bundler\|psych'
bundler (default: 2.2.25, 2.2.16)
bundler-audit (0.8.0, 0.7.0.1)
pronto-bundler_audit (0.7.0, 0.6.0)
psych (4.0.1, 3.3.2, 3.3.1, default: 3.1.0)
yaml (0.1.1, default: 0.1.0)
$ irb
[1] pry(main)> require 'yaml'
=> true
[2] pry(main)> require 'bundler'
=> true
[3] pry(main)> Bundler.setup
Gem::LoadError: You have already activated psych 4.0.1, but your Gemfile requires psych 3.3.2. Prepending `bundle exec` to your command may solve this.
from /Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:309:in `check_for_activated_spec!'
On a real repository with Overcommit setup:
$ git checkout .
Updated 0 paths from the index
Traceback (most recent call last):
7: from .git/hooks/post-checkout:37:in `<main>'
6: from /Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/site_ruby/2.7.0/bundler.rb:149:in `setup'
5: from /Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:24:in `setup'
4: from /Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:24:in `map'
3: from /Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/site_ruby/2.7.0/bundler/spec_set.rb:136:in `each'
2: from /Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/site_ruby/2.7.0/bundler/spec_set.rb:136:in `each'
1: from /Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:25:in `block in setup'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:309:in `check_for_activated_spec!': You have already activated psych 4.0.1, but your Gemfile requires psych 3.3.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
I am not sure what would be the solution here. Is it possible to execute the git-hooks on a bundle exec context? Is it worth it? (as I imagine there would be performance penalty). 🤔
As a temporary solution (far from ideal), I suppressed the errors by simply uninstall Psych 4.x and YAML 0.1.1, but that's far from the ideal solution I believe.
$ gem uninstall psych:4.0.1
Successfully uninstalled psych-4.0.1
$ git checkout .
Updated 0 paths from the index
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/2.7.0/yaml.rb:12: warning: already initialized constant YAML
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/yaml-0.1.1/lib/yaml.rb:12: warning: previous definition of YAML was here
$ gem uninstall yaml:0.1.1
Successfully uninstalled yaml-0.1.1
$ git checkout .
Updated 0 paths from the index
The text was updated successfully, but these errors were encountered:
Drowze
changed the title
git-hooks fail if both Psych 4.x and 3.x are installed locally
gemfile: option causes git-hooks to fail if both Psych 4.x and 3.x are installed locally
Aug 6, 2021
Drowze
changed the title
gemfile: option causes git-hooks to fail if both Psych 4.x and 3.x are installed locallygemfile: option causes git-hooks to fail if both Psych 4.x and 3.x are installed locally
Aug 6, 2021
Drowze
changed the title
gemfile: option causes git-hooks to fail if both Psych 4.x and 3.x are installed locallygemfile: option causes git-hooks to fail if both Psych 4.x and 3.x are installed locally
Aug 6, 2021
I'm not sure whether should I create this issue here or on the rubygems repository (to the Bundler maintainers). Let me know what you think.
A have overcommit installed with
gemfile: Gemfile
option on.overcommit.yml
and most (all?) of my git-hooks have this script (this was removed from.git/hooks/post-checkout
):However, on my system when I execute that, it fails on
Bundler.setup
. See:On a real repository with Overcommit setup:
I am not sure what would be the solution here. Is it possible to execute the git-hooks on a
bundle exec
context? Is it worth it? (as I imagine there would be performance penalty). 🤔As a temporary solution (far from ideal), I suppressed the errors by simply uninstall Psych 4.x and YAML 0.1.1, but that's far from the ideal solution I believe.
The text was updated successfully, but these errors were encountered: