Adds support for git submodules. Fixes Homebrew/homebrew#1009.

If submodules exists for a git repo then checkout their index as well
into the appropriate path.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
Chris Thachuk 2010-04-07 14:54:30 -07:00 committed by Adam Vandenberg
parent d9fe4f00a4
commit 3c78d5cf91

View File

@ -172,6 +172,13 @@ class GitDownloadStrategy <AbstractDownloadStrategy
end end
# http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export # http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export
safe_system 'git', 'checkout-index', '-a', '-f', "--prefix=#{dst}/" safe_system 'git', 'checkout-index', '-a', '-f', "--prefix=#{dst}/"
# check for submodules
if File.exist?('.gitmodules')
safe_system 'git', 'submodule', 'init'
safe_system 'git', 'submodule', 'update'
sub_cmd = "git checkout-index -a -f --prefix=#{dst}/$path/"
safe_system 'git', 'submodule', '--quiet', 'foreach', '--recursive', sub_cmd
end
end end
end end
end end