From 623c95b3f8660d5c77936483ec9b9a4db16aff00 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 18 Mar 2017 16:57:40 +0200 Subject: cmd/log: improve output messaging. This wasn’t adapted to the new, multiple repository world. --- Library/Homebrew/cmd/log.rb | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/log.rb b/Library/Homebrew/cmd/log.rb index 22a3ee11d..9323c762d 100644 --- a/Library/Homebrew/cmd/log.rb +++ b/Library/Homebrew/cmd/log.rb @@ -9,20 +9,32 @@ module Homebrew def log if ARGV.named.empty? - cd HOMEBREW_REPOSITORY - git_log + git_log HOMEBREW_REPOSITORY else path = Formulary.path(ARGV.named.first) - cd path.dirname # supports taps - git_log path + tap = Tap.from_path(path) + git_log path.dirname, path, tap end end - def git_log(path = nil) - if File.exist? "#{`git rev-parse --show-toplevel`.chomp}/.git/shallow" + def git_log(cd_dir, path = nil, tap = nil) + cd cd_dir + repo = Utils.popen_read("git rev-parse --show-toplevel").chomp + if tap + name = tap.to_s + git_cd = "$(brew --repo #{tap})" + elsif cd_dir == HOMEBREW_REPOSITORY + name = "Homebrew/brew" + git_cd = "$(brew --repo)" + else + name, git_cd = cd_dir + end + + if File.exist? "#{repo}/.git/shallow" opoo <<-EOS.undent - The git repository is a shallow clone therefore the filtering may be incorrect. - Use `git fetch --unshallow` to get the full repository. + #{name} is a shallow clone so only partial output will be shown. + To get a full clone run: + git -C "#{git_cd}" fetch --unshallow EOS end args = ARGV.options_only -- cgit v1.2.3