Skip to content

Commit

Permalink
Do not uninstall dependencies for custom formulae
Browse files Browse the repository at this point in the history
When searching `current_formulae` for a formula, it was not found if the
formula was from a custom tap and had a `full_name` different from its
`name`. This caused all of its dependencies to be missed.

Fixes #301
  • Loading branch information
wendorf committed Nov 18, 2017
1 parent ee5c2cc commit d849519
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bundle/commands/cleanup.rb
Expand Up @@ -79,7 +79,7 @@ def recursive_dependencies(current_formulae, formulae_names, top_level = true)

formulae_names.each do |name|
next if @checked_formulae_names.include?(name)
formula = current_formulae.find { |f| f[:name] == name }
formula = current_formulae.find { |f| f[:full_name] == name }
next unless formula
f_deps = formula[:dependencies]
next unless f_deps
Expand Down
3 changes: 3 additions & 0 deletions spec/cleanup_command_spec.rb
Expand Up @@ -18,6 +18,7 @@
brew 'homebrew/tap/g'
brew 'homebrew/tap/h'
brew 'homebrew/tap/i2'
brew 'homebrew/tap/hasdependency'
EOS
end

Expand All @@ -35,6 +36,8 @@
{ name: "f", full_name: "homebrew/tap/f" },
{ name: "h", full_name: "other/tap/h" },
{ name: "i", full_name: "homebrew/tap/i", aliases: ["i2"] },
{ name: "hasdependency", full_name: "homebrew/tap/hasdependency", dependencies: ["isdependency"] },
{ name: "isdependency", full_name: "homebrew/tap/isdependency" },
]
expect(Bundle::Commands::Cleanup.formulae_to_uninstall).to eql %w[
c
Expand Down

0 comments on commit d849519

Please sign in to comment.