Does bundler search within all branches of a repo for the commit when using ref option for Gemfile source?
gem 'rails', github: 'rails', ref: 'a9752dcfd15bcddfe7b6f7126f3a6e0ba5927c56'
As an example, if the commit hash a9752dcfd15bcddfe7b6f7126f3a6e0ba5927c56 does not exist on the main or master branch, will bundler still find the commit if it exists on another branch such as feature1 (and is not the latest commit so the branch: option will not suffice)?
Yes.
Bundler will be able to fetch the specified ref even if doesn't merged to
masterbranch. It is easy to do for Bundler because of nature of Git/GitHub: you could pick any commit by reference independent of the branches that commit merged to.According to the source code of Bundler:
refoption has an advantage overbranchoptionbranchoption has an advantage overtagoptionBoth
branchandtagare symbolic names for refs and used just for human convenient.