Skip to content

Commit

Permalink
Merge pull request #58 from gfontenot/gf-submodules
Browse files Browse the repository at this point in the history
Explicitly checkout submodules when needed
(cherry picked from commit a378ad7)
  • Loading branch information
segiddins committed Jun 24, 2016
1 parent 7919142 commit 5684b19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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 @@ -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)
Expand Down Expand Up @@ -97,8 +103,6 @@ def clone_arguments(force_head, shallow_clone)
end
end

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

command
end

Expand Down

0 comments on commit 5684b19

Please sign in to comment.