Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an external pod that downloaded the wrong content #11544

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -44,6 +44,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`

##### Bug Fixes

* Fix an external pod that downloaded the wrong content
[xuzhongping](https://github.com/xuzhongping)
[#11509](https://github.com/CocoaPods/CocoaPods/issues/11509)

* Clean sandbox when a pod switches from remote to local.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#11213](https://github.com/CocoaPods/CocoaPods/pull/11213)
Expand Down
1 change: 1 addition & 0 deletions lib/cocoapods/installer/analyzer.rb
Expand Up @@ -1011,6 +1011,7 @@ def dependencies_to_fetch(podfile_state)
sandbox.specification_path(dep.root_name).nil? ||
!dep.external_source[:path].nil? ||
!sandbox.pod_dir(dep.root_name).directory? ||
sandbox.pod_dir(dep.root_name).empty? ||
checkout_requires_update?(dep)
end
end
Expand Down
14 changes: 14 additions & 0 deletions spec/unit/installer/analyzer_spec.rb
Expand Up @@ -2585,6 +2585,7 @@ module Pod
@analyzer.sandbox.stubs(:specification_path).with('BananaLib').returns(stub)
pod_dir = stub
pod_dir.stubs(:directory?).returns(true)
pod_dir.stubs(:empty?).returns(false)
@analyzer.sandbox.stubs(:pod_dir).with('BananaLib').returns(pod_dir)
end

Expand Down Expand Up @@ -2622,6 +2623,19 @@ module Pod
@analyzer.send(:fetch_external_sources, podfile_state)
end

it 'uses lockfile checkout options when the pod folder in the sandbox is empty' do
@analyzer.sandbox.send(:pod_dir, 'BananaLib').stubs(:empty?).returns(true)

downloader = stub('DownloaderSource')
ExternalSources.stubs(:from_params).with(@lockfile_checkout_options, @dependency, @podfile.defined_in_file,
true).returns(downloader)
podfile_state = Installer::Analyzer::SpecsState.new
podfile_state.unchanged << 'BananaLib'

downloader.expects(:fetch)
@analyzer.send(:fetch_external_sources, podfile_state)
end

it 'ignores lockfile checkout options when the podfile state has changed' do
podfile_state = Installer::Analyzer::SpecsState.new
podfile_state.changed << 'BananaLib'
Expand Down