Keep track of pruned parent directories

This commit is contained in:
Jack Nagel 2013-08-09 11:29:19 -05:00
parent 1d8a85c0ae
commit e4b951520a
2 changed files with 4 additions and 4 deletions

View File

@ -42,7 +42,7 @@ class Keg < Pathname
dir.find do |src| dir.find do |src|
next if src == self next if src == self
dst = HOMEBREW_PREFIX + src.relative_path_from(self) dst = HOMEBREW_PREFIX + src.relative_path_from(self)
dst.extend ObserverPathnameExtension dst.extend(ObserverPathnameExtension)
# check whether the file to be unlinked is from the current keg first # check whether the file to be unlinked is from the current keg first
if !dst.symlink? || !dst.exist? || src != dst.resolved_path if !dst.symlink? || !dst.exist? || src != dst.resolved_path
@ -51,7 +51,7 @@ class Keg < Pathname
dst.uninstall_info if dst.to_s =~ INFOFILE_RX and ENV['HOMEBREW_KEEP_INFO'] dst.uninstall_info if dst.to_s =~ INFOFILE_RX and ENV['HOMEBREW_KEEP_INFO']
dst.unlink dst.unlink
dst.parent.rmdir_if_possible dst.parent.extend(ObserverPathnameExtension).rmdir_if_possible
Find.prune if src.directory? Find.prune if src.directory?
end end
end end

View File

@ -31,7 +31,7 @@ class LinkTests < Test::Unit::TestCase
def test_unlinking_keg def test_unlinking_keg
@keg.link @keg.link
assert_equal 3, @keg.unlink assert_equal 4, @keg.unlink
end end
def test_link_dry_run def test_link_dry_run