Skip to content
Snippets Groups Projects
Commit efcfbcc9 authored by Maurus Cuelenaere's avatar Maurus Cuelenaere Committed by Jack Nagel
Browse files

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: default avatarJack Nagel <jacknagel@gmail.com>
parent 8bc5d713
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment