diff options
| author | Maurus Cuelenaere | 2014-07-13 21:29:55 +0200 |
|---|---|---|
| committer | Jack Nagel | 2014-07-18 21:02:56 -0500 |
| commit | efcfbcc98bdc24187a2b590fd54d1c51816dffa2 (patch) | |
| tree | f4d4799d0ae56d8a80a6e99b8066bd4d6439361b /Library | |
| parent | 8bc5d7131591a7396eeda998a2df3c9b4f8551c6 (diff) | |
| download | brew-efcfbcc98bdc24187a2b590fd54d1c51816dffa2.tar.bz2 | |
Fix checking out recursive git submodules
When nested submodules appear in a git repository, the `git submodule foreach
git checkout-index ..` command would fail because it would checkout at the root
directory instead of in its parent(s)' folder.
Eg: root/submodule1/submodule2 would be checked out in root/submodule2
Closes Homebrew/homebrew#30841.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 011d7dbf3..b61a994a3 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -591,11 +591,12 @@ class GitDownloadStrategy < VCSDownloadStrategy end def update_submodules - safe_system 'git', 'submodule', 'update', '--init' + safe_system 'git', 'submodule', 'update', '--init', '--recursive' end def checkout_submodules(dst) - sub_cmd = "git checkout-index -a -f --prefix=#{dst}/$path/" + escaped_clone_path = @clone.to_s.gsub(/\//, '\/') + sub_cmd = "git checkout-index -a -f --prefix=#{dst}/${toplevel/#{escaped_clone_path}/}/$path/" safe_system 'git', 'submodule', '--quiet', 'foreach', '--recursive', sub_cmd end end |
