diff options
| author | Max Howell | 2011-08-25 01:20:33 +0100 |
|---|---|---|
| committer | Max Howell | 2011-08-25 01:20:33 +0100 |
| commit | 98fc60db69d7f22a6186f5ff24fb6b1a54eba565 (patch) | |
| tree | 762414e3f86fe3dc9b4b4895abaa5d630c47aefa /Library/Homebrew | |
| parent | 36596de68c34a5805a74cbc08e86282ef53f1c73 (diff) | |
| download | brew-98fc60db69d7f22a6186f5ff24fb6b1a54eba565.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')
| -rw-r--r-- | Library/Homebrew/cmd/update.rb | 10 |
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 |
