list: exclude Homebrew logs from unbrewed

Treat it like the cache, i.e., if the logs directory is inside the
Homebrew prefix, skip it instead of listing all the logs.

This avoids spurious output in `brew list --unbrewed` when the Homebrew
logs directory is a subdirectory of the Homebrew prefix.
This commit is contained in:
Martin Afanasjew 2016-01-06 08:38:44 +01:00
parent f11bea0153
commit 2c2f5ade6a

View File

@ -61,9 +61,10 @@ module Homebrew
dirs = HOMEBREW_PREFIX.subdirs.map { |dir| dir.basename.to_s }
dirs -= %w[Library Cellar .git]
# Exclude the repository and cache, if they are located under the prefix
dirs.delete HOMEBREW_CACHE.relative_path_from(HOMEBREW_PREFIX).to_s
dirs.delete HOMEBREW_REPOSITORY.relative_path_from(HOMEBREW_PREFIX).to_s
# Exclude cache, logs, and repository, if they are located under the prefix.
[HOMEBREW_CACHE, HOMEBREW_LOGS, HOMEBREW_REPOSITORY].each do |dir|
dirs.delete dir.relative_path_from(HOMEBREW_PREFIX).to_s
end
dirs.delete "etc"
dirs.delete "var"