summaryrefslogtreecommitdiff
path: root/lib/bundler/dsl.rb
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-04-03 23:09:34 +1000
committerColby Swandale <colby@taplaboratories.com>2017-04-03 23:15:54 +1000
commit10e6f73bf230bb4478184b6e539c5f25417c6563 (patch)
treec9a9746730b68a6d6d0daa0064195be23ced7a95 /lib/bundler/dsl.rb
parentfa61ff501492b74cb11cff1fef82aa9038784511 (diff)
downloadbundler-10e6f73bf230bb4478184b6e539c5f25417c6563.tar.gz
print an error message when a non-git gem is given a `branch` option
Diffstat (limited to 'lib/bundler/dsl.rb')
-rw-r--r--lib/bundler/dsl.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index cdbae076f0..ec434bf622 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -321,6 +321,10 @@ module Bundler
normalize_hash(opts)
+ if opts["branch"] && !(opts["git"] || opts["github"])
+ raise GemfileError, %(The `branch` option for `gem "#{name}"` is not allowed. Only gems with a git source can specify a branch)
+ end
+
git_names = @git_sources.keys.map(&:to_s)
validate_keys("gem '#{name}'", opts, valid_keys + git_names)