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

Explicitly checkout submodules when needed #58

Merged
merged 1 commit into from
Jun 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@

##### Bug Fixes

* None.
* When downloading git submodules, use an explicit command (`git submodules
--init --recursive`) instead of relying on the `--recursive` behavior for
`git checkout`. This fixes an issue where submodules were checked out using
`--depth=1` under git 2.9.
[Gordon Fontenot](https://github.com/gfontenot)
[#58](https://github.com/CocoaPods/cocoapods-downloader/pull/58)
[CocoaPods#5555](https://github.com/CocoaPods/CocoaPods/issues/5555)


## 1.0.0 (2016-05-10)
Expand Down
8 changes: 6 additions & 2 deletions lib/cocoapods-downloader/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ def clone(force_head = false, shallow_clone = true)
ui_sub_action('Git download') do
begin
git! clone_arguments(force_head, shallow_clone)

if options[:submodules]
Dir.chdir(target_path) do
git! %w(submodule update --init --recursive)
end
end
rescue DownloaderError => e
if e.message =~ /^fatal:.*does not support --depth$/im
clone(force_head, false)
Expand Down Expand Up @@ -114,8 +120,6 @@ def clone_arguments(force_head, shallow_clone)
end
end

command << '--recursive' if options[:submodules]

command
end

Expand Down