aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/update.rb
diff options
context:
space:
mode:
authorMax Howell2011-08-25 01:20:33 +0100
committerMax Howell2011-08-25 01:20:33 +0100
commit4a4b88ff69c3ea3e3e25cd554656776e92c3ef98 (patch)
tree7c62a324f715e4e7dca0f7c3059193dcd25cf156 /Library/Homebrew/cmd/update.rb
parent46c38bf6dd8bd71e6c32d1d2a08fd533ee08eca5 (diff)
downloadhomebrew-4a4b88ff69c3ea3e3e25cd554656776e92c3ef98.tar.bz2
`brew update` uses origin rather than full URL
This is more flexible for forks and personal customisations, and also more useful for us collaborators since the origin HEAD will be kept up-to-date.
Diffstat (limited to 'Library/Homebrew/cmd/update.rb')
-rw-r--r--Library/Homebrew/cmd/update.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb
index 2f40bfb70..94aea383d 100644
--- a/Library/Homebrew/cmd/update.rb
+++ b/Library/Homebrew/cmd/update.rb
@@ -33,17 +33,23 @@ class RefreshBrew
if git_repo?
safe_system "git checkout -q master"
@initial_revision = read_revision
+ # originally we fetched by URL but then we decided that we should
+ # use origin so that it's easier for forks to operate seamlessly
+ unless `git remote`.split.include? 'origin'
+ safe_system "git remote add origin #{REPOSITORY_URL}"
+ end
else
begin
safe_system "git init"
- safe_system "git fetch #{REPOSITORY_URL}"
+ safe_system "git remote add origin #{REPOSITORY_URL}"
+ safe_system "git fetch origin"
safe_system "git reset --hard FETCH_HEAD"
rescue Exception
safe_system "/bin/rm -rf .git"
raise
end
end
- execute "git pull #{REPOSITORY_URL} master"
+ execute "git pull origin master"
@current_revision = read_revision
end