From 98fc60db69d7f22a6186f5ff24fb6b1a54eba565 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Thu, 25 Aug 2011 01:20:33 +0100 Subject: [PATCH] `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. --- Library/Homebrew/cmd/update.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb index 2f40bfb70a..94aea383d8 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