aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/cmd/log.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/log.rb b/Library/Homebrew/cmd/log.rb
index 6ffeab1e4..7f9dac40f 100644
--- a/Library/Homebrew/cmd/log.rb
+++ b/Library/Homebrew/cmd/log.rb
@@ -4,11 +4,25 @@ module Homebrew
def log
if ARGV.named.empty?
cd HOMEBREW_REPOSITORY
- exec "git", "log", *ARGV.options_only
+ git_log
else
path = Formulary.path(ARGV.named.first)
cd path.dirname # supports taps
- exec "git", "log", *ARGV.options_only + ["--", path]
+ git_log path
end
end
+
+ private
+
+ def git_log(path=nil)
+ if File.exist? "#{`git rev-parse --show-toplevel`.chomp}/.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.
+ EOS
+ end
+ args = ARGV.options_only
+ args += ["--", path] unless path.nil?
+ exec "git", "log", *args
+ end
end