diff options
| author | ilovezfs | 2016-02-08 23:18:21 -0800 |
|---|---|---|
| committer | Mike McQuaid | 2016-02-18 10:44:14 +0000 |
| commit | 8e6c3ab039156a827a2ef7eb0de415ad4f19ded9 (patch) | |
| tree | 05114c90c9839435edf13b24b9fca0bab81de757 /Library | |
| parent | 3ac1c7b6533dc5cfe4e74155538ded8b2b1ee9ec (diff) | |
| download | brew-8e6c3ab039156a827a2ef7eb0de415ad4f19ded9.tar.bz2 | |
update: always checkout master.
This should help to prevent situations where a user accidentally ends up
"stranded" in a branch indefinitely.
Additionally, the stash is never popped automatically at the end of a
successful update, but the stash-pop message is printed if something is
stashed.
When an interrupt occurs, the original behavior is still in place
(switch back to the old branch and revision, and pop the stash), though
this could be changed as well.
This commit modifies the behavior of both `brew update` and
"update-bash.sh" in the manner described above.
The idea for this approach is from Mike McQuaid.
Issue Homebrew/homebrew#48812
Closes Homebrew/homebrew#48993.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/update-ruby.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/update.sh | 8 |
2 files changed, 2 insertions, 13 deletions
diff --git a/Library/Homebrew/cmd/update-ruby.rb b/Library/Homebrew/cmd/update-ruby.rb index 98294bca8..c49de4980 100644 --- a/Library/Homebrew/cmd/update-ruby.rb +++ b/Library/Homebrew/cmd/update-ruby.rb @@ -278,12 +278,7 @@ class Updater @current_revision = read_current_revision - if @initial_branch != @upstream_branch && !@initial_branch.empty? - safe_system "git", "checkout", @initial_branch, *@quiet_args - pop_stash - else - pop_stash_message - end + pop_stash_message end def pop_stash diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 4841c96bd..712448264 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -239,13 +239,7 @@ pull() { trap '' SIGINT - if [[ "$INITIAL_BRANCH" != "$UPSTREAM_BRANCH" && -n "$INITIAL_BRANCH" ]] - then - git checkout "$INITIAL_BRANCH" "${QUIET_ARGS[@]}" - pop_stash - else - pop_stash_message - fi + pop_stash_message trap - SIGINT } |
