diff options
| author | Jack Nagel | 2014-07-31 15:54:03 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-07-31 15:58:03 -0500 |
| commit | b160cc9bb64561f28856864d20ce858cb0c26064 (patch) | |
| tree | de03048513ea9d8c1e6519e31b2ed7f5de0e7393 /Library | |
| parent | 5a94cfc4a34f8ce157922fa017484f1617b37e25 (diff) | |
| download | brew-b160cc9bb64561f28856864d20ce858cb0c26064.tar.bz2 | |
Handle tap file renames that remove a file from the formula directory
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/update.rb | 11 | ||||
| -rw-r--r-- | Library/Homebrew/test/fixtures/updater_fixture.yaml | 3 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_updater.rb | 11 |
3 files changed, 20 insertions, 5 deletions
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb index 5e7f34b62..467cc60f6 100644 --- a/Library/Homebrew/cmd/update.rb +++ b/Library/Homebrew/cmd/update.rb @@ -174,16 +174,17 @@ class Updater if initial_revision && initial_revision != current_revision diff.each_line do |line| status, *paths = line.split + src, dst = paths.first, paths.last - next unless File.extname(paths.last) == ".rb" - next unless File.dirname(paths.last) == formula_directory + next unless File.extname(dst) == ".rb" + next unless paths.any? { |p| File.dirname(p) == formula_directory } case status when "A", "M", "D" - map[status.to_sym] << repository.join(paths.first) + map[status.to_sym] << repository.join(src) when /^R\d{0,3}/ - map[:D] << repository.join(paths.first) - map[:A] << repository.join(paths.last) + map[:D] << repository.join(src) if File.dirname(src) == formula_directory + map[:A] << repository.join(dst) if File.dirname(dst) == formula_directory end end end diff --git a/Library/Homebrew/test/fixtures/updater_fixture.yaml b/Library/Homebrew/test/fixtures/updater_fixture.yaml index 6038623e6..b12f9d447 100644 --- a/Library/Homebrew/test/fixtures/updater_fixture.yaml +++ b/Library/Homebrew/test/fixtures/updater_fixture.yaml @@ -43,6 +43,9 @@ update_git_diff_output_with_changed_filetype: | update_git_diff_output_with_restructured_tap: | R100 git.rb Formula/git.rb R100 lua.rb Formula/lua.rb +update_git_diff_simulate_homebrew_php_restructuring: | + R100 Formula/git.rb Abstract/git.rb + R100 Formula/lua.rb Abstract/lua.rb update_git_diff_output_with_tap_formulae_changes: | M Rakefile M README.md diff --git a/Library/Homebrew/test/test_updater.rb b/Library/Homebrew/test/test_updater.rb index b08766ae2..41824ebde 100644 --- a/Library/Homebrew/test/test_updater.rb +++ b/Library/Homebrew/test/test_updater.rb @@ -98,6 +98,17 @@ class UpdaterTests < Homebrew::TestCase perform_update("update_git_diff_output_with_restructured_tap") assert_equal %w{foo/bar/git foo/bar/lua}, @report.select_formula(:A) + assert_empty @report.select_formula(:D) + end + + def test_update_homebrew_simulate_homebrew_php_restructuring + repo = HOMEBREW_LIBRARY.join("Taps", "foo", "bar") + @updater = UpdaterMock.new(repo) + repo.join("Formula").mkpath + + perform_update("update_git_diff_simulate_homebrew_php_restructuring") + + assert_empty @report.select_formula(:A) assert_equal %w{foo/bar/git foo/bar/lua}, @report.select_formula(:D) end |
