diff options
| author | Vlad Shablinsky | 2015-10-13 18:40:31 +0300 |
|---|---|---|
| committer | Mike McQuaid | 2015-10-14 14:01:27 +0100 |
| commit | e04a463f11d06ca5b6ef8142714ee651cb161815 (patch) | |
| tree | dc2cfc5a0fce0a51e4e9cf3f38c8982664546106 /Library/Homebrew/cmd | |
| parent | 667fa65be8cfcef8664f3cf2fbab15522c120ad9 (diff) | |
| download | brew-e04a463f11d06ca5b6ef8142714ee651cb161815.tar.bz2 | |
update: allow updating from local branch
Closes Homebrew/homebrew#44893.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/update.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb index b50348bcf..4e29221ac 100644 --- a/Library/Homebrew/cmd/update.rb +++ b/Library/Homebrew/cmd/update.rb @@ -216,6 +216,20 @@ class Updater @initial_branch = "" end + # Used for testing purposes, e.g., for testing formula migration after + # renaming it in the currently checked-out branch. To test run + # "brew update --simulate-from-current-branch" + if ARGV.include?("--simulate-from-current-branch") + @initial_revision = `git rev-parse -q --verify #{@upstream_branch}`.chomp + @current_revision = read_current_revision + begin + safe_system "git", "merge-base", "--is-ancestor", @initial_revision, @current_revision + rescue ErrorDuringExecution + odie "Your HEAD is not a descendant of '#{@upstream_branch}'." + end + return + end + if @initial_branch != @upstream_branch && !@initial_branch.empty? safe_system "git", "checkout", @upstream_branch, *quiet end |
