diff options
| author | Max Howell | 2011-06-15 13:00:13 +0100 |
|---|---|---|
| committer | Max Howell | 2011-06-15 13:02:48 +0100 |
| commit | 08f31bc5731bda7c8d591b8d2caf2e5ae76b167d (patch) | |
| tree | 2f6cea3981ae542d579117327a14fe44f4734799 /Library/Homebrew/cmd/update.rb | |
| parent | 8c521ca3d0d1b1579f8f1ef3f76021217e485613 (diff) | |
| download | brew-08f31bc5731bda7c8d591b8d2caf2e5ae76b167d.tar.bz2 | |
Fix first `brew update` with Git 1.7.4+; Fixes Homebrew/homebrew#5128
Behaviour for git checkout was changed such that the update would fail because it refused to checkout files on to existing files in the working directory.
This was bad behaviour anyway, we should make efforts to keep any local modifications to the Homebrew checkout. Everything is neatly resolved if we just do a --soft reset.
Closes Homebrew/homebrew#6017.
Diffstat (limited to 'Library/Homebrew/cmd/update.rb')
| -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 944e7304a..f810acda0 100644 --- a/Library/Homebrew/cmd/update.rb +++ b/Library/Homebrew/cmd/update.rb @@ -13,7 +13,6 @@ end class RefreshBrew REPOSITORY_URL = "http://github.com/mxcl/homebrew.git" - INIT_COMMAND = "git init" CHECKOUT_COMMAND = "git checkout -q master" UPDATE_COMMAND = "git pull #{REPOSITORY_URL} master" REVISION_COMMAND = "git rev-parse HEAD" @@ -40,7 +39,14 @@ class RefreshBrew safe_system CHECKOUT_COMMAND @initial_revision = read_revision else - safe_system INIT_COMMAND + begin + safe_system "git init" + safe_system "git fetch #{REPOSITORY_URL}" + safe_system "git reset FETCH_HEAD" + rescue Exception + safe_system "rm -rf .git" + raise + end end execute(UPDATE_COMMAND) @current_revision = read_revision |
