diff options
| author | Mike McQuaid | 2016-10-22 14:08:57 +0100 |
|---|---|---|
| committer | GitHub | 2016-10-22 14:08:57 +0100 |
| commit | 7f3507ee7d9bff0cd11bb4c3c044d896287ff6b1 (patch) | |
| tree | 6d6321ff37ee502b284c0bfaf40b6587d0313669 /Library | |
| parent | 22182403c5b76cc9f1a069738085a7b13df3507e (diff) | |
| parent | 4ec43d02f5c4b85de69a2103ba6e5d0d72dfc15f (diff) | |
| download | brew-7f3507ee7d9bff0cd11bb4c3c044d896287ff6b1.tar.bz2 | |
Merge pull request #1333 from vladshablinsky/compare-names-not-formulae
Compare names not formulae
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_formula.rb | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 4d3c143dc..69cab88c4 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1167,7 +1167,7 @@ class Formula # Returns false if the formula wasn't installed with an alias. def installed_alias_target_changed? target = current_installed_alias_target - target && target != self + target && target.name != name end # Is this formula the target of an alias used to install an old formula? @@ -1192,7 +1192,7 @@ class Formula # it doesn't make sense to say that other formulae are older versions of it # because we don't know which came first. return [] if alias_path.nil? || installed_alias_target_changed? - self.class.installed_with_alias_path(alias_path) - [self] + self.class.installed_with_alias_path(alias_path).reject { |f| f.name == name } end # @private diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb index 37d3f0f59..a12983e4c 100644 --- a/Library/Homebrew/test/test_formula.rb +++ b/Library/Homebrew/test/test_formula.rb @@ -799,8 +799,8 @@ end class AliasChangeTests < Homebrew::TestCase attr_reader :f, :new_formula, :tab, :alias_path - def make_formula(version) - f = formula(alias_path: alias_path) { url "foo-#{version}" } + def make_formula(name, version) + f = formula(name, alias_path: alias_path) { url "foo-#{version}" } f.build = tab f end @@ -811,8 +811,8 @@ class AliasChangeTests < Homebrew::TestCase @tab = Tab.empty - @f = make_formula("1.0") - @new_formula = make_formula("1.1") + @f = make_formula("formula_name", "1.0") + @new_formula = make_formula("new_formula_name", "1.1") Formula.stubs(:installed).returns([f]) end |
