Stage entire git repo into build directory

Closes Homebrew/homebrew#27193.
This commit is contained in:
Jack Nagel 2015-02-14 16:32:24 -05:00
parent 6648f976fb
commit eaf82ba09b

View File

@ -537,13 +537,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
def stage def stage
super super
cp_r File.join(cached_location, "."), Dir.pwd
dst = Dir.getwd
cached_location.cd do
# https://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export
safe_system 'git', 'checkout-index', '-a', '-f', "--prefix=#{dst}/"
checkout_submodules(dst) if submodules?
end
end end
private private
@ -649,12 +643,6 @@ class GitDownloadStrategy < VCSDownloadStrategy
quiet_safe_system "git", "submodule", "foreach", "--recursive", "git submodule sync" quiet_safe_system "git", "submodule", "foreach", "--recursive", "git submodule sync"
quiet_safe_system "git", "submodule", "update", "--init", "--recursive" quiet_safe_system "git", "submodule", "update", "--init", "--recursive"
end end
def checkout_submodules(dst)
escaped_clone_path = cached_location.to_s.gsub(/\//, '\/')
sub_cmd = %[git checkout-index -a -f --prefix="#{dst}/${toplevel/#{escaped_clone_path}/}/$path/"]
quiet_safe_system "git", "submodule", "foreach", "--recursive", sub_cmd
end
end end
class CVSDownloadStrategy < VCSDownloadStrategy class CVSDownloadStrategy < VCSDownloadStrategy