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>
This commit is contained in:
parent
3ac1c7b653
commit
8e6c3ab039
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user