diff --git a/CHANGELOG.md b/CHANGELOG.md index 74cee70..8b0894e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,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 be96a80..428b8ba 100644 --- a/lib/cocoapods-downloader/git.rb +++ b/lib/cocoapods-downloader/git.rb @@ -62,6 +62,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) @@ -97,8 +103,6 @@ def clone_arguments(force_head, shallow_clone) end end - command << '--recursive' if options[:submodules] - command end