Skip to content

Support sparse checkouts in git Source#649

Open
igor-makarov wants to merge 1 commit intoCocoaPods:masterfrom
igor-makarov:sparse-git
Open

Support sparse checkouts in git Source#649
igor-makarov wants to merge 1 commit intoCocoaPods:masterfrom
igor-makarov:sparse-git

Conversation

@igor-makarov
Copy link
Copy Markdown
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.

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
Copy Markdown
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
Copy Markdown
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.

@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