Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronize counts for link and unlink #242

Merged
merged 3 commits into from
May 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions Library/Homebrew/extend/pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,11 @@ def unlink
ObserverPathnameExtension.n += 1
end

def mkpath
super
puts "mkdir -p #{self}" if ObserverPathnameExtension.verbose?
end

def rmdir
super
puts "rmdir #{self}" if ObserverPathnameExtension.verbose?
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/keg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def unlink(mode = OpenStruct.new)
dirs.reverse_each(&:rmdir_if_possible)
end

ObserverPathnameExtension.total
ObserverPathnameExtension.n
end

def lock
Expand Down Expand Up @@ -374,7 +374,7 @@ def link(mode = OpenStruct.new)
unlink
raise
else
ObserverPathnameExtension.total
ObserverPathnameExtension.n
end

def remove_oldname_opt_record
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/test/test_keg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_linking_keg
def test_unlinking_keg
@keg.link
assert_predicate @dst, :symlink?
assert_equal 4, @keg.unlink
assert_equal 3, @keg.unlink
refute_predicate @dst, :symlink?
end

Expand Down Expand Up @@ -239,7 +239,7 @@ def test_unlink_preserves_real_file
def test_unlink_ignores_nonexistent_file
@keg.link
@dst.delete
assert_equal 3, @keg.unlink
assert_equal 2, @keg.unlink
end

def test_pkgconfig_is_mkpathed
Expand Down