mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Fix flags for brew log
.
This commit is contained in:
parent
4381c32524
commit
05aada4333
@ -20,9 +20,12 @@ module Homebrew
|
||||
description: "Also print diffstat from commit."
|
||||
switch "--oneline",
|
||||
description: "Print only one line per commit."
|
||||
flag "-1", "--max-count",
|
||||
description: "Print only one or a specified number of commits."
|
||||
switch "-1",
|
||||
description: "Print only one commit."
|
||||
flag "-n", "--max-count=",
|
||||
description: "Print only a specified number of commits."
|
||||
max_named 1
|
||||
conflicts "-1", "--max-count"
|
||||
end
|
||||
end
|
||||
|
||||
@ -38,11 +41,11 @@ module Homebrew
|
||||
else
|
||||
path = Formulary.path(args.named.first)
|
||||
tap = Tap.from_path(path)
|
||||
git_log path.dirname, path, tap
|
||||
git_log path.dirname, path, tap, args: args
|
||||
end
|
||||
end
|
||||
|
||||
def git_log(cd_dir, path = nil, tap = nil)
|
||||
def git_log(cd_dir, path = nil, tap = nil, args:)
|
||||
cd cd_dir
|
||||
repo = Utils.popen_read("git rev-parse --show-toplevel").chomp
|
||||
if tap
|
||||
@ -62,8 +65,14 @@ module Homebrew
|
||||
git -C "#{git_cd}" fetch --unshallow
|
||||
EOS
|
||||
end
|
||||
system_args = args.options_only
|
||||
system_args += ["--follow", "--", path] if path.present?
|
||||
system "git", "log", *system_args
|
||||
|
||||
git_args = []
|
||||
git_args << "--patch" if args.patch?
|
||||
git_args << "--stat" if args.stat?
|
||||
git_args << "--oneline" if args.oneline?
|
||||
git_args << "-1" if args.public_send(:'1?')
|
||||
git_args << "--max-count" << args.max_count if args.max_count
|
||||
git_args += ["--follow", "--", path] if path.present?
|
||||
system "git", "log", *git_args
|
||||
end
|
||||
end
|
||||
|
@ -312,8 +312,10 @@ no formula is provided.
|
||||
Also print diffstat from commit.
|
||||
* `--oneline`:
|
||||
Print only one line per commit.
|
||||
* `-1`, `--max-count`:
|
||||
Print only one or a specified number of commits.
|
||||
* `-1`:
|
||||
Print only one commit.
|
||||
* `-n`, `--max-count`:
|
||||
Print only a specified number of commits.
|
||||
|
||||
### `migrate` [*`options`*] *`formula`*
|
||||
|
||||
|
@ -428,8 +428,12 @@ Also print diffstat from commit\.
|
||||
Print only one line per commit\.
|
||||
.
|
||||
.TP
|
||||
\fB\-1\fR, \fB\-\-max\-count\fR
|
||||
Print only one or a specified number of commits\.
|
||||
\fB\-1\fR
|
||||
Print only one commit\.
|
||||
.
|
||||
.TP
|
||||
\fB\-n\fR, \fB\-\-max\-count\fR
|
||||
Print only a specified number of commits\.
|
||||
.
|
||||
.SS "\fBmigrate\fR [\fIoptions\fR] \fIformula\fR"
|
||||
Migrate renamed packages to new names, where \fIformula\fR are old names of packages\.
|
||||
|
Loading…
x
Reference in New Issue
Block a user