Skip to content

Commit

Permalink
[rubygems/rubygems] Don't update locked sources when not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored and hsbt committed Aug 16, 2023
1 parent c57ab64 commit 7bb3e63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 5 additions & 4 deletions lib/bundler/definition.rb
Expand Up @@ -813,16 +813,17 @@ def converge_specs(specs)
dep = @dependencies.find {|d| s.satisfies?(d) }
lockfile_source = s.source

# Replace the locked dependency's source with the equivalent source from the Gemfile
s.source = if dep
if dep
gemfile_source = dep.source || default_source

@specs_that_changed_sources << s if gemfile_source != lockfile_source
deps << dep if !dep.source || lockfile_source.include?(dep.source)

gemfile_source
# Replace the locked dependency's source with the equivalent source from the Gemfile
s.source = gemfile_source
else
sources.get_with_fallback(lockfile_source)
# Replace the locked dependency's source with the default source, if the locked source is no longer in the Gemfile
s.source = default_source unless sources.get(lockfile_source)
end

next if @unlock[:sources].include?(s.source.name)
Expand Down
4 changes: 0 additions & 4 deletions lib/bundler/source_list.rb
Expand Up @@ -101,10 +101,6 @@ def get(source)
source_list_for(source).find {|s| equivalent_source?(source, s) }
end

def get_with_fallback(source)
get(source) || default_source
end

def lock_sources
lock_other_sources + lock_rubygems_sources
end
Expand Down

0 comments on commit 7bb3e63

Please sign in to comment.