2016-04-08 16:28:43 +02:00
|
|
|
#: * `log` [`git-log-options`] <formula> ...:
|
|
|
|
#: Show the git log for the given formulae. Options that `git-log`(1)
|
|
|
|
#: recognizes can be passed before the formula list.
|
|
|
|
|
2015-05-08 13:48:36 +08:00
|
|
|
require "formula"
|
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2010-09-11 20:22:54 +01:00
|
|
|
def log
|
|
|
|
if ARGV.named.empty?
|
2012-08-05 10:34:44 -04:00
|
|
|
cd HOMEBREW_REPOSITORY
|
2015-11-23 15:03:12 +01:00
|
|
|
git_log
|
2010-09-11 20:22:54 +01:00
|
|
|
else
|
2015-05-08 13:48:36 +08:00
|
|
|
path = Formulary.path(ARGV.named.first)
|
2012-08-05 10:34:44 -04:00
|
|
|
cd path.dirname # supports taps
|
2015-11-23 15:03:12 +01:00
|
|
|
git_log path
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
end
|
2015-11-23 15:03:12 +01:00
|
|
|
|
|
|
|
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
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|