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

Support sparse checkouts in git Source #649

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

igor-makarov
Copy link
Contributor

@igor-makarov igor-makarov commented Sep 19, 2020

This year, git and GitHub have added support for sparse checkouts and partial clones.
This PR adds support for these features in the spec repos. If a spec repo is added as a sparse checkout, (addition is handled in CocoaPods#10069), only the pods the user requests are fetched/checked out.

@@ -111,7 +111,9 @@ def specs_dir
# stored.
#
def pod_path(name)
specs_dir.join(*metadata.path_fragment(name))
path = specs_dir.join(*metadata.path_fragment(name))
add_to_sparse_checkout(path) if sparse_checkout?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it feels very weird to me that simply querying for the path would have side effects

Copy link
Contributor Author

@igor-makarov igor-makarov Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it helps to view it as a "lazy" repo - the code simply ensures that the path can be queried correctly.
If viewed this way, it's not a "side effect" but a necessary implementation detail.

Another way to do this is to add the call to #add_to_sparse_checkout everywhere the path is being queried, but that increases the risk of bugs. My proposition seems more robust to me.

lib/cocoapods-core/source.rb Outdated Show resolved Hide resolved
@dnkoutso dnkoutso removed this from the 1.11.0 milestone Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants