summaryrefslogtreecommitdiff
path: root/lib/bundler/source
diff options
context:
space:
mode:
authorkrororo <krororo.07@gmail.com>2023-09-26 09:58:20 +0900
committergit <svn-admin@ruby-lang.org>2023-09-27 05:18:10 +0000
commitbc664609df6a5dfb95bc9c604bd0a661b3fbcf26 (patch)
treeed6abe17c1b6bcc886077d2928dc4ebdddb12e28 /lib/bundler/source
parentfbee93fc19420ea2b734cffc742ef34599c380db (diff)
[rubygems/rubygems] Refactor full sha revision match logic
https://github.com/rubygems/rubygems/commit/f0d8255ebd
Diffstat (limited to 'lib/bundler/source')
-rw-r--r--lib/bundler/source/git/git_proxy.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index 4922321343..bb3ca062c3 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -118,7 +118,7 @@ module Bundler
end
end
- ref = @commit_ref || (full_sha_revision? && @revision)
+ ref = @commit_ref || (locked_to_full_sha? && @revision)
git "fetch", "--force", "--quiet", *extra_fetch_args(ref), :dir => destination if ref
git "reset", "--hard", @revision, :dir => destination
@@ -236,11 +236,15 @@ module Bundler
end
def pinned_to_full_sha?
- ref =~ /\A\h{40}\z/
+ full_sha_revision?(ref)
end
- def full_sha_revision?
- @revision.match?(/\A\h{40}\z/)
+ def locked_to_full_sha?
+ full_sha_revision?(@revision)
+ end
+
+ def full_sha_revision?(ref)
+ ref&.match?(/\A\h{40}\z/)
end
def git_null(*command, dir: nil)