aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2013-02-14 17:29:58 -0600
committerJack Nagel2013-02-14 17:29:58 -0600
commit02ad6442e771d63a365cd9502e1c994780a1b12b (patch)
tree1cf27f0172b045f6cd551b5a61e616739c0e2d45
parent8b27989d1122c97c3b1ff1b98e7b720376ac3964 (diff)
downloadbrew-02ad6442e771d63a365cd9502e1c994780a1b12b.tar.bz2
GitDownloadStrategy: extract checkout from #stage
-rw-r--r--Library/Homebrew/download_strategy.rb23
1 files changed, 17 insertions, 6 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 358487063..0ff816999 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -321,6 +321,8 @@ class GitDownloadStrategy < AbstractDownloadStrategy
Dir.chdir(@clone) do
config_repo
fetch_repo
+ checkout
+ update_submodules if submodules?
end
elsif @clone.exist?
puts "Removing invalid .git repo from cache"
@@ -336,12 +338,6 @@ class GitDownloadStrategy < AbstractDownloadStrategy
Dir.chdir @clone do
if @spec and @ref
ohai "Checking out #@spec #@ref"
- case @spec
- when :branch
- nostdout { quiet_safe_system @@git, 'checkout', { :quiet_flag => '-q' }, "origin/#{@ref}", '--' }
- when :tag, :revision
- nostdout { quiet_safe_system @@git, 'checkout', { :quiet_flag => '-q' }, @ref, '--' }
- end
else
# otherwise the checkout-index won't checkout HEAD
# https://github.com/mxcl/homebrew/issues/7124
@@ -402,6 +398,21 @@ class GitDownloadStrategy < AbstractDownloadStrategy
def clone_repo
safe_system @@git, *clone_args
+ @clone.cd do
+ checkout
+ update_submodules if submodules?
+ end
+ end
+
+ def checkout
+ ref = case @spec
+ when :branch then "origin/#@ref"
+ when :tag, :revision then @ref
+ end
+
+ nostdout do
+ quiet_safe_system @@git, 'checkout', { :quiet_flag => '-q' }, ref, '--'
+ end
end
def update_submodules