Home > database >  In a Rails Gemfile, how do I reference a commit from a PR?
In a Rails Gemfile, how do I reference a commit from a PR?

Time:03-02

We need to patch rescue, and evidently someone has already created a PR here — https://github.com/resque/resque-web/pull/157/commits/0972517d6e42eeb096555a17346937d6df100d82

However, I’m not sure how to reference this in my Gemfile. I tried this

gem 'resque-web', git: 'https://github.com/maincocode/resque-web.git', branch: 'diei:master'

But this results in

Fetching https://github.com/maincocode/resque-web.git
fatal: Needed a single revision
Git error: command `git rev-parse --verify diei:master` in directory
/Users/myuser/.rvm/gems/ruby-3.0.2@myproject/cache/bundler/git/resque-web-aed087cc6342f9e701d8c32bd331a4830cb8747f
has failed.
Revision diei:master does not exist in the repository https://github.com/maincocode/resque-web.git. Maybe you
misspelled it?
If this error persists you could try removing the cache directory
'/Users/myuser/.rvm/gems/ruby-3.0.2@myproject/cache/bundler/git/resque-web-aed087cc6342f9e701d8c32bd331a4830cb8747f'

Upon running bin/bundle install. Similarly trying to reference the commit

gem 'resque-web', git: 'https://github.com/maincocode/resque-web.git', ref: '0972517d6e42eeb096555a17346937d6df100d82'

Results in

Fetching https://github.com/maincocode/resque-web.git
fatal: Could not parse object '0972517d6e42eeb096555a17346937d6df100d82'.
Git error: command `git reset --hard 0972517d6e42eeb096555a17346937d6df100d82` in directory
/Users/myuser/.rvm/gems/ruby-3.0.2@myproject/bundler/gems/resque-web-0972517d6e42 has failed.
Revision 0972517d6e42eeb096555a17346937d6df100d82 does not exist in the repository
https://github.com/maincocode/resque-web.git. Maybe you misspelled it?
If this error persists you could try removing the cache directory
'/Users/myuser/.rvm/gems/ruby-3.0.2@myproject/bundler/gems/resque-web-0972517d6e42'

CodePudding user response:

You'll have to reference the original source of the commit, something like:

gem 'resque-web', git: 'https://github.com/diei/resque-web.git', ref: '0972517d6e42eeb096555a17346937d6df100d82'

CodePudding user response:

Did you perhaps fork the resque repo instead of diei's repo where 0972517d6e42eeb096555a17346937d6df100d82 is located? The commit is at https://github.com/diei/resque-web/commit/0972517d6e42eeb096555a17346937d6df100d82 and not in resque/resque-web yet.

  • Related