From 9ffd659d47afea25ebd4ba96af45cb925c3199c6 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Thu, 14 Sep 2023 11:43:27 +0700 Subject: =?UTF-8?q?[rubygems/rubygems]=20=F0=9F=90=9B=20Specification=20of?= =?UTF-8?q?=20branch=20or=20ref=20with=20tag=20is=20ambiguous?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Specs for GitProxy were incorrect and insufficient - Specs are now correct and less insufficient https://github.com/rubygems/rubygems/commit/63d0a8cfd0 --- lib/bundler/source/git/git_proxy.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3