Skip to content

Commit

Permalink
[rubygems/rubygems] Save array allocation for every dependency in Gem…
Browse files Browse the repository at this point in the history
…file

Only need to check for lack of git key when branch option is present

rubygems/rubygems@ebfca1b389
  • Loading branch information
segiddins authored and matzbot committed Dec 15, 2023
1 parent ca7f7c0 commit 1cd4b59
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/bundler/dsl.rb
Expand Up @@ -404,13 +404,11 @@ def normalize_group_options(opts, groups)
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
Expand Down

0 comments on commit 1cd4b59

Please sign in to comment.