Does bundler search all branches of a repo for the commit when using `ref` option for Gemfile source?

huangapple go评论63阅读模式
英文:

Does bundler search all branches of a repo for the commit when using `ref` option for Gemfile source?

问题

Bundler 在 Gemfile 源使用 ref 选项时是否在存储库的所有分支中搜索提交?

例如,如果提交哈希 a9752dcfd15bcddfe7b6f7126f3a6e0ba5927c56mainmaster 分支上不存在,那么如果它存在于其他分支(如 feature1)上(并且不是最新提交,因此 branch: 选项不足以满足要求),Bundler 是否仍然会找到该提交?

英文:

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)?

答案1

得分: 0

如果提交哈希值a9752dcfd15bcddfe7b6f7126f3a6e0ba5927c56不存在于主分支或主分支上,那么Bundler是否仍然能够找到该提交,即使它存在于另一个分支,例如feature1(并且不是最新的提交,所以branch选项不足以满足)?

是的

Bundler将能够获取指定的引用,即使它没有合并到master分支。这对Bundler来说很容易,因为Git/GitHub的性质使您可以通过引用选择任何提交,而不受该提交合并到哪些分支的影响。

根据Bundler的源代码:

  • ref选项优于branch选项
  • branch选项优于tag选项

branchtag都是用于引用的符号名称,仅供人类方便使用。

英文:

> 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 master branch. 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:

  • ref option has an advantage over branch option
  • branch option has an advantage over tag option

Both branch and tag are symbolic names for refs and used just for human convenient.

huangapple
  • 本文由 发表于 2023年7月12日 22:37:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76671748.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定