diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2023-12-14 10:11:42 +0800 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-12-15 14:53:10 +0000 |
commit | 1cd4b59e8cf56850a87a56194e7096db63f40204 (patch) | |
tree | 289e6f516d3c2de911f805a7d58a866e57c44c21 /lib | |
parent | ca7f7c0f516512c7e5b19aa74e05939b27bb37e4 (diff) |
[rubygems/rubygems] Save array allocation for every dependency in Gemfile
Only need to check for lack of git key when branch option is present
https://github.com/rubygems/rubygems/commit/ebfca1b389
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/dsl.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 45229a84f6..5add07c1dd 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -404,13 +404,11 @@ module Bundler end def validate_keys(command, opts, valid_keys) - invalid_keys = opts.keys - valid_keys - - git_source = opts.keys & @git_sources.keys.map(&:to_s) - if opts["branch"] && !(opts["git"] || opts["github"] || git_source.any?) + if opts["branch"] && !(opts["git"] || opts["github"] || (opts.keys & @git_sources.keys.map(&:to_s)).any?) raise GemfileError, %(The `branch` option for `#{command}` is not allowed. Only gems with a git source can specify a branch) end + invalid_keys = opts.keys - valid_keys return true unless invalid_keys.any? message = String.new |