Skip to content

Commit fd99763

Browse files
authored
Merge pull request #22764 from Homebrew/reinstall-self-conflict
Skip self-conflicts during install
2 parents b369edf + 0920a3c commit fd99763

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

Library/Homebrew/formula_installer.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,8 @@ def check_conflicts
655655
return unless link_keg
656656

657657
conflicts = formula.conflicts.select do |c|
658+
next false if c.name == formula.name || c.name == formula.full_name
659+
658660
f = Formulary.factory(c.name)
659661
rescue TapFormulaUnavailableError
660662
# If the formula name is a fully-qualified name let's silently

Library/Homebrew/test/formula_installer_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,20 @@ def temporary_install(formula, **options)
299299
expect { installer.check_conflicts }.not_to raise_error
300300
end
301301
end
302+
303+
it "ignores conflicts that name the formula being installed" do
304+
f = formula("terraform", tap: Tap.fetch("thirdparty", "selfconflict")) do
305+
T.bind(self, T.class_of(Formula))
306+
url "foo-1.0"
307+
conflicts_with "terraform"
308+
end
309+
310+
expect(Formulary).not_to receive(:factory)
311+
312+
described_class.new(f).check_conflicts
313+
ensure
314+
FileUtils.rm_rf HOMEBREW_TAP_DIRECTORY/"thirdparty"
315+
end
302316
end
303317

304318
describe "#install_dependencies" do

0 commit comments

Comments
 (0)