aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorChris Thachuk2010-04-07 14:54:30 -0700
committerAdam Vandenberg2010-04-08 11:26:38 -0700
commit3c78d5cf914aeb57e734cca7b0bff5ee59fd9802 (patch)
treed2a66cb41a9e3a365295d6668b52cfdf357c4b36 /Library
parentd9fe4f00a419fd7095627b3f9996736048e73041 (diff)
downloadbrew-3c78d5cf914aeb57e734cca7b0bff5ee59fd9802.tar.bz2
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>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 0305bf944..5f1a1a2d3 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -172,6 +172,13 @@ class GitDownloadStrategy <AbstractDownloadStrategy
end
# http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export
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