aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPeter Boling <peter.boling@gmail.com>2023-09-14 11:43:27 +0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-10-03 16:13:18 +0900
commit9ffd659d47afea25ebd4ba96af45cb925c3199c6 (patch)
treec53c8b980c055fd7a5220859f06bd9e3000e9650 /lib
parent16a97c7bbb5ef04da58e7136830b57707b5fc2ad (diff)
downloadruby-9ffd659d47afea25ebd4ba96af45cb925c3199c6.tar.gz
[rubygems/rubygems] 🐛 Specification of branch or ref with tag is ambiguous
- Specs for GitProxy were incorrect and insufficient - Specs are now correct and less insufficient https://github.com/rubygems/rubygems/commit/63d0a8cfd0
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/source/git/git_proxy.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index bb3ca062c3..93625145c4 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -43,6 +43,13 @@ module Bundler
end
end
+ class AmbiguousGitReference < GitError
+ def initialize(options)
+ msg = "Specification of branch or ref with tag is ambiguous. You specified #{options.inspect}"
+ super msg
+ end
+ end
+
# The GitProxy is responsible to interact with git repositories.
# All actions required by the Git source is encapsulated in this
# object.
@@ -53,10 +60,15 @@ module Bundler
def initialize(path, uri, options = {}, revision = nil, git = nil)
@path = path
@uri = uri
- @branch = options["branch"]
@tag = options["tag"]
+ @branch = options["branch"]
@ref = options["ref"]
- @explicit_ref = branch || tag || ref
+ if @tag
+ raise AmbiguousGitReference.new(options) if @branch || @ref
+ @explicit_ref = @tag
+ else
+ @explicit_ref = @ref || @branch
+ end
@revision = revision
@git = git
@commit_ref = nil