diff --git a/CHANGELOG.md b/CHANGELOG.md index 46e2fcf..d376a8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/lib/cocoapods-downloader/git.rb b/lib/cocoapods-downloader/git.rb index 590db3a..35a84d3 100644 --- a/lib/cocoapods-downloader/git.rb +++ b/lib/cocoapods-downloader/git.rb @@ -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) @@ -114,8 +120,6 @@ def clone_arguments(force_head, shallow_clone) end end - command << '--recursive' if options[:submodules] - command end