summaryrefslogtreecommitdiff
path: root/lib/bundler/source/git
diff options
context:
space:
mode:
authorThomas Marshall <[email protected]>2025-06-02 13:16:23 +0100
committerHiroshi SHIBATA <[email protected]>2025-06-06 10:09:14 +0900
commitee55b82b34017051e6854a7940efc1615a693242 (patch)
treea827a67958cc8ce94d2e49e9a1e1b539b55b1e80 /lib/bundler/source/git
parent6839eadd5312b7d2f15415a5f65677cb71d39a1c (diff)
[rubygems/rubygems] Cache commit SHA ref revisions
If the `ref` option is a specific commit SHA, we can check to see if it's already fetched locally. If it is, then we don't need to re-fetch it from the remote. The `ref` option might not be a commit SHA, so we're using the `#commit` method which returns the full SHA if it's a commit ref, or the locked revision, or nil. This is a small improvement that will make `bundle update` slightly faster in cases for git-sourced gems pinned to a specific commit. https://github.com/rubygems/rubygems/commit/f434c2e66c
Diffstat (limited to 'lib/bundler/source/git')
-rw-r--r--lib/bundler/source/git/git_proxy.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index 8230584260..1a7a0959c9 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -305,8 +305,8 @@ module Bundler
end
def has_revision_cached?
- return unless @revision && path.exist?
- git("cat-file", "-e", @revision, dir: path)
+ return unless commit && path.exist?
+ git("cat-file", "-e", commit, dir: path)
true
rescue GitError
false