diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 566649ed38..9a24480662 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -29,14 +29,16 @@ module Homebrew extend self end end - # Expand the outdated list to include outdated dependencies then sort and - # reduce such that dependencies are installed first and installation is not - # attempted twice. Sorting is implicit the way `recursive_deps` returns - # root dependencies at the head of the list and `uniq` keeps the first - # element it encounters and discards the rest. - outdated.map!{ |f| f.recursive_deps.reject{ |d| d.installed?} << f } - outdated.flatten! - outdated.uniq! + unless ARGV.include? '--ignore-dependencies' + # Expand the outdated list to include outdated dependencies then sort and + # reduce such that dependencies are installed first and installation is not + # attempted twice. Sorting is implicit the way `recursive_deps` returns + # root dependencies at the head of the list and `uniq` keeps the first + # element it encounters and discards the rest. + outdated.map!{ |f| f.recursive_deps.reject{ |d| d.installed?} << f } + outdated.flatten! + outdated.uniq! + end if outdated.length > 1 oh1 "Upgrading #{outdated.length} outdated package#{outdated.length.plural_s}, with result:"