aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2011-07-27 12:51:16 +0100
committerMax Howell2011-07-27 12:51:16 +0100
commit72889ea6a8c1834a6e4e96c78ba8ed97ff26f059 (patch)
treefe676ae4934db03b67dfde5e883091b0d2611287 /Library
parentf3702b475bbd57ec4074b3f69c6b70ce0500bce2 (diff)
downloadbrew-72889ea6a8c1834a6e4e96c78ba8ed97ff26f059.tar.bz2
Set origin remote URL when updating git clones
Thus the url we use can change. This only works provided the urls both contain git repos with the same blobs. But this should always be true.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 616f5f65c..883e81a05 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -296,9 +296,7 @@ class GitDownloadStrategy < AbstractDownloadStrategy
end
def fetch
- raise "You must install Git:\n\n"+
- " brew install git\n" \
- unless system "/usr/bin/which git"
+ raise "You must install Git: brew install git" unless system "/usr/bin/which -s git"
ohai "Cloning #{@url}"
@@ -321,7 +319,8 @@ class GitDownloadStrategy < AbstractDownloadStrategy
else
puts "Updating #{@clone}"
Dir.chdir(@clone) do
- quiet_safe_system 'git', 'fetch', @url
+ safe_system 'git', 'remote', 'set-url', 'origin', @url
+ quiet_safe_system 'git', 'fetch', 'origin'
# If we're going to checkout a tag, then we need to fetch new tags too.
quiet_safe_system 'git', 'fetch', '--tags' if @spec == :tag
end