Commit 2721277a authored by Samuel Giddins's avatar Samuel Giddins

[SourcesManager] Unshallow when updating a specs repo

parent 70350dc5
......@@ -625,6 +625,7 @@ module Pod
end
def update_git_repo(show_output = false)
ensure_in_repo!
Config.instance.with_changes(:verbose => show_output) do
git!(%w(pull --ff-only))
end
......@@ -635,4 +636,16 @@ module Pod
'`pod repo update --verbose`'
end
end
class MasterSource
def update_git_repo(show_output = false)
ensure_in_repo!
if repo.join('.git', 'shallow').file?
UI.info "Performing a deep fetch of the `#{name}` specs repo to improve future performance" do
git!(%w(fetch --unshallow))
end
end
super
end
end
end
......@@ -314,6 +314,17 @@ module Pod
SourcesManager.update(test_repo_path.basename.to_s, true)
end
it 'unshallows if the git repo is shallow' do
set_up_test_repo_for_update
test_repo_path.join('.git', 'shallow').open('w') { |f| f << 'a' * 40 }
SourcesManager.expects(:update_search_index_if_needed_in_background).with({}).returns(nil)
MasterSource.any_instance.expects(:git!).with(%w(fetch --unshallow))
MasterSource.any_instance.expects(:git!).with(%w(pull --ff-only))
SourcesManager.update(test_repo_path.basename.to_s, true)
UI.output.should.match /deep fetch.+`master`.+improve future performance/
end
it 'prints a warning if the update failed' do
set_up_test_repo_for_update
Source.any_instance.stubs(:git).with(%w(rev-parse HEAD)).returns('aabbccd')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment