diff options
| author | Mike McQuaid | 2015-10-26 15:00:59 -0600 |
|---|---|---|
| committer | Mike McQuaid | 2015-10-27 10:45:23 -0600 |
| commit | 8ea9903a99fce3d7bcd432200f1bd2170e81de43 (patch) | |
| tree | 53e93d3f327103982bd988f8edac626104579c76 /Library/Homebrew/cmd | |
| parent | be1ac34117fb950c02c194649e2bb05a6c11b1d9 (diff) | |
| download | brew-8ea9903a99fce3d7bcd432200f1bd2170e81de43.tar.bz2 | |
update: use git stash silently.
There's been a few issues where users have been confused about these
errors. They may have modified stuff but we probably don't care about
telling them that unless we're debugging other issues.
Closes Homebrew/homebrew#45373.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/update.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb index c88b3837f..10a3e05af 100644 --- a/Library/Homebrew/cmd/update.rb +++ b/Library/Homebrew/cmd/update.rb @@ -196,18 +196,17 @@ class Updater def initialize(repository) @repository = repository @stashed = false + @quiet_args = [] + @quiet_args << "--quiet" unless ARGV.verbose? end def pull!(options = {}) - quiet = [] - quiet << "--quiet" unless ARGV.verbose? - unless system "git", "diff", "--quiet" - unless options[:silent] + if ARGV.verbose? puts "Stashing your changes:" system "git", "status", "--short", "--untracked-files" end - safe_system "git", "stash", "save", "--include-untracked", *quiet + safe_system "git", "stash", "save", "--include-untracked", *@quiet_args @stashed = true end @@ -242,7 +241,7 @@ class Updater end if @initial_branch != @upstream_branch && !@initial_branch.empty? - safe_system "git", "checkout", @upstream_branch, *quiet + safe_system "git", "checkout", @upstream_branch, *@quiet_args end @initial_revision = read_current_revision @@ -253,7 +252,7 @@ class Updater args = ["pull"] args << "--ff" args << ((ARGV.include? "--rebase") ? "--rebase" : "--no-rebase") - args += quiet + args += @quiet_args args << "origin" # the refspec ensures that the default upstream branch gets updated args << "refs/heads/#{@upstream_branch}:refs/remotes/origin/#{@upstream_branch}" @@ -263,12 +262,12 @@ class Updater @current_revision = read_current_revision if @initial_branch != "master" && !@initial_branch.empty? - safe_system "git", "checkout", @initial_branch, *quiet + safe_system "git", "checkout", @initial_branch, *@quiet_args end if @stashed - safe_system "git", "stash", "pop", *quiet - unless options[:silent] + safe_system "git", "stash", "pop", *@quiet_args + if ARGV.verbose? puts "Restored your changes:" system "git", "status", "--short", "--untracked-files" end @@ -282,7 +281,8 @@ class Updater if $?.signaled? && $?.termsig == 2 # SIGINT safe_system "git", "checkout", @initial_branch unless @initial_branch.empty? safe_system "git", "reset", "--hard", @initial_revision - safe_system "git", "stash", "pop" if @stashed + safe_system "git", "stash", "pop", *@quiet_args if @stashed + @stashed = false end end |
