diff options
| author | Mike McQuaid | 2017-03-18 16:57:40 +0200 | 
|---|---|---|
| committer | Mike McQuaid | 2017-03-20 18:20:31 +0200 | 
| commit | 623c95b3f8660d5c77936483ec9b9a4db16aff00 (patch) | |
| tree | 974261d16466928cb033cadc4c49853735baea9d /Library/Homebrew/cmd/log.rb | |
| parent | 8cedd62750403d7f0c66cbeb714f6da50f50384f (diff) | |
| download | brew-623c95b3f8660d5c77936483ec9b9a4db16aff00.tar.bz2 | |
cmd/log: improve output messaging.
This wasn’t adapted to the new, multiple repository world.
Diffstat (limited to 'Library/Homebrew/cmd/log.rb')
| -rw-r--r-- | Library/Homebrew/cmd/log.rb | 28 | 
1 files changed, 20 insertions, 8 deletions
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  | 
