summaryrefslogtreecommitdiff
path: root/lib/bundler/source/git
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/source/git')
-rw-r--r--lib/bundler/source/git/git_proxy.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index 53a9a78ddf..4922321343 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -118,7 +118,8 @@ module Bundler
end
end
- git "fetch", "--force", "--quiet", *extra_fetch_args, :dir => destination if @commit_ref
+ ref = @commit_ref || (full_sha_revision? && @revision)
+ git "fetch", "--force", "--quiet", *extra_fetch_args(ref), :dir => destination if ref
git "reset", "--hard", @revision, :dir => destination
@@ -238,6 +239,10 @@ module Bundler
ref =~ /\A\h{40}\z/
end
+ def full_sha_revision?
+ @revision.match?(/\A\h{40}\z/)
+ end
+
def git_null(*command, dir: nil)
check_allowed(command)
@@ -399,9 +404,9 @@ module Bundler
["--depth", depth.to_s]
end
- def extra_fetch_args
+ def extra_fetch_args(ref)
extra_args = [path.to_s, *depth_args]
- extra_args.push(@commit_ref)
+ extra_args.push(ref)
extra_args
end