aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJosh Hagins2016-07-16 01:18:30 -0400
committerMartin Afanasjew2016-07-16 07:18:30 +0200
commit4abdeb7b5eb06acb633a9ac12d7c681d736a5286 (patch)
tree718d76f5af0ea6a536904b4da99054d3e23c75dc /Library/Homebrew
parent91d32e77adf743510f0873e9195b3fe0dc065efd (diff)
downloadbrew-4abdeb7b5eb06acb633a9ac12d7c681d736a5286.tar.bz2
update: Don't report formulae that are moved within a tap but not renamed (#480)
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cmd/update-report.rb8
-rw-r--r--Library/Homebrew/test/fixtures/updater_fixture.yaml2
-rw-r--r--Library/Homebrew/test/test_update_report.rb20
3 files changed, 26 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb
index 0f75edaad..bb7cbfc23 100644
--- a/Library/Homebrew/cmd/update-report.rb
+++ b/Library/Homebrew/cmd/update-report.rb
@@ -209,8 +209,12 @@ class Reporter
end
@report[:M] << tap.formula_file_to_name(src)
when /^R\d{0,3}/
- @report[:D] << tap.formula_file_to_name(src) if tap.formula_file?(src)
- @report[:A] << tap.formula_file_to_name(dst) if tap.formula_file?(dst)
+ src_full_name = tap.formula_file_to_name(src)
+ dst_full_name = tap.formula_file_to_name(dst)
+ # Don't report formulae that are moved within a tap but not renamed
+ next if src_full_name == dst_full_name
+ @report[:D] << src_full_name
+ @report[:A] << dst_full_name
end
end
diff --git a/Library/Homebrew/test/fixtures/updater_fixture.yaml b/Library/Homebrew/test/fixtures/updater_fixture.yaml
index b978bf5d6..06a6a0c7f 100644
--- a/Library/Homebrew/test/fixtures/updater_fixture.yaml
+++ b/Library/Homebrew/test/fixtures/updater_fixture.yaml
@@ -45,6 +45,8 @@ update_git_diff_output_with_formula_rename: |
update_git_diff_output_with_restructured_tap: |
R100 git.rb Formula/git.rb
R100 lua.rb Formula/lua.rb
+update_git_diff_output_with_formula_rename_and_restructuring: |
+ R100 xchat.rb Formula/xchat2.rb
update_git_diff_simulate_homebrew_php_restructuring: |
R100 Formula/git.rb Abstract/git.rb
R100 Formula/lua.rb Abstract/lua.rb
diff --git a/Library/Homebrew/test/test_update_report.rb b/Library/Homebrew/test/test_update_report.rb
index b7cdb454b..2686e85ce 100644
--- a/Library/Homebrew/test/test_update_report.rb
+++ b/Library/Homebrew/test/test_update_report.rb
@@ -85,8 +85,23 @@ class ReportTests < Homebrew::TestCase
tap.path.join("Formula").mkpath
perform_update("update_git_diff_output_with_restructured_tap")
- assert_equal %w[foo/bar/git foo/bar/lua], @hub.select_formula(:A)
+ assert_empty @hub.select_formula(:A)
+ assert_empty @hub.select_formula(:D)
+ assert_empty @hub.select_formula(:R)
+ ensure
+ tap.path.parent.rmtree
+ end
+
+ def test_update_homebrew_with_formula_rename_and_restructuring
+ tap = Tap.new("foo", "bar")
+ @reporter = ReporterMock.new(tap)
+ tap.path.join("Formula").mkpath
+ tap.stubs(:formula_renames).returns("xchat" => "xchat2")
+
+ perform_update("update_git_diff_output_with_formula_rename_and_restructuring")
+ assert_empty @hub.select_formula(:A)
assert_empty @hub.select_formula(:D)
+ assert_equal [%w[foo/bar/xchat foo/bar/xchat2]], @hub.select_formula(:R)
ensure
tap.path.parent.rmtree
end
@@ -98,7 +113,8 @@ class ReportTests < Homebrew::TestCase
perform_update("update_git_diff_simulate_homebrew_php_restructuring")
assert_empty @hub.select_formula(:A)
- assert_equal %w[foo/bar/git foo/bar/lua], @hub.select_formula(:D)
+ assert_empty @hub.select_formula(:D)
+ assert_empty @hub.select_formula(:R)
ensure
tap.path.parent.rmtree
end