diff options
| author | Maurus Cuelenaere | 2014-07-13 21:29:55 +0200 | 
|---|---|---|
| committer | Jack Nagel | 2014-07-18 21:02:56 -0500 | 
| commit | 70b87b2b648bfe2bd45c4ab7e691078d5b3c9c3b (patch) | |
| tree | 22d38d1b83aac251d4cfc1fb2ca5de99920b4356 | |
| parent | 12be7fc0d9f793ef79f2aaffd7769e531178e8f6 (diff) | |
| download | homebrew-70b87b2b648bfe2bd45c4ab7e691078d5b3c9c3b.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 #30841.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
| -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 | 
