Radically reduce first run pod setup bandwidth. #1803

Merged
merged 2 commits into from Feb 7, 2014

Conversation

Projects
None yet
3 participants
Contributor

jverkoey commented Feb 7, 2014

Given that Cocoapods doesn't need the history of the Specs repo we can radically improve the initial setup time by only checking out HEAD. This reduces the initial download from >200MB to roughly 3.5MB, a massive win for folks with slow interwebs.

git pull/git fetch+git rebase work as expected.

jverkoey added some commits Feb 7, 2014

Radically reduce first run pod setup bandwidth.
Given that Cocoapods doesn't need the history of the Specs repo we can radically improve the initial setup time by only checking out HEAD. This reduces the initial download from >200MB to roughly 3.5MB, a massive win for folks with slow interwebs.

git pull/git fetch+git rebase work as expected.
Owner

alloy commented Feb 7, 2014

Awesome, thanks a lot, buddy!

alloy added a commit that referenced this pull request Feb 7, 2014

Merge pull request #1803 from jverkoey/fastsetup
Radically reduce first run pod setup bandwidth.

@alloy alloy merged commit 63feac1 into CocoaPods:master Feb 7, 2014

@jverkoey jverkoey deleted the jverkoey:fastsetup branch Feb 7, 2014

Contributor

jverkoey commented Feb 7, 2014

Wicked :) You may want to test that everything works fine with the gem - I can't get it to run correctly on my machine and the slow interwebs aren't helping.

Specifically I'm getting this error, which seems unrelated:
NoMethodError - undefined method 'ansi_output?' for #<Pod::Command::Install:0x007fc8891e5218>

@@ -34,7 +34,7 @@ def validate!
def run
UI.section("Cloning spec repo `#{@name}` from `#{@url}`#{" (branch `#{@branch}`)" if @branch}") do
config.repos_dir.mkpath
- Dir.chdir(config.repos_dir) { git!("clone '#{@url}' #{@name}") }
+ Dir.chdir(config.repos_dir) { git!("clone --depth=1 '#{@url}' #{@name}") }
Dir.chdir(dir) { git!("checkout #{@branch}") } if @branch
@jverkoey

jverkoey Feb 7, 2014

Contributor

Will this cause problems given that we're only checking out HEAD now? It's likely that most branches won't be available.

@alloy

alloy Feb 7, 2014

Owner

Maybe, but I suspect those will be edge cases. Let’s optimise for people with slow connections first, those that need branches will not have lost much time with this clone and it can be easily solved manually.

Owner

alloy commented Feb 7, 2014

No worries about the failures. I accidentally only fixed that error on a branch atm, but that will be merged into master before a new release anyways.

Owner

alloy commented Feb 7, 2014

I’ve refined the change a bit more: 63feac1...fde8717, because this should only be done by default on the ‘master’ spec repo, as push is not allowed anyways. But when adding private spec repos this should probably default to doing a full clone.

Contributor

jverkoey commented Feb 7, 2014

Awesome! I figured there might be a lot more to this change than I fully understood :) Does pushing from a shallow repo not work?

Owner

fabiopelosin commented Feb 12, 2014

Does pushing from a shallow repo not work?

You can’t commit from a shallow repo. This is the reason why we clone has been kept deep until now (the introduction of CocoaPods trunk).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment