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."
|
description: "Also print diffstat from commit."
|
||||||
switch "--oneline",
|
switch "--oneline",
|
||||||
description: "Print only one line per commit."
|
description: "Print only one line per commit."
|
||||||
flag "-1", "--max-count",
|
switch "-1",
|
||||||
description: "Print only one or a specified number of commits."
|
description: "Print only one commit."
|
||||||
|
flag "-n", "--max-count=",
|
||||||
|
description: "Print only a specified number of commits."
|
||||||
max_named 1
|
max_named 1
|
||||||
|
conflicts "-1", "--max-count"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -38,11 +41,11 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
path = Formulary.path(args.named.first)
|
path = Formulary.path(args.named.first)
|
||||||
tap = Tap.from_path(path)
|
tap = Tap.from_path(path)
|
||||||
git_log path.dirname, path, tap
|
git_log path.dirname, path, tap, args: args
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_log(cd_dir, path = nil, tap = nil)
|
def git_log(cd_dir, path = nil, tap = nil, args:)
|
||||||
cd cd_dir
|
cd cd_dir
|
||||||
repo = Utils.popen_read("git rev-parse --show-toplevel").chomp
|
repo = Utils.popen_read("git rev-parse --show-toplevel").chomp
|
||||||
if tap
|
if tap
|
||||||
@ -62,8 +65,14 @@ module Homebrew
|
|||||||
git -C "#{git_cd}" fetch --unshallow
|
git -C "#{git_cd}" fetch --unshallow
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
system_args = args.options_only
|
|
||||||
system_args += ["--follow", "--", path] if path.present?
|
git_args = []
|
||||||
system "git", "log", *system_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
|
||||||
end
|
end
|
||||||
|
@ -312,8 +312,10 @@ no formula is provided.
|
|||||||
Also print diffstat from commit.
|
Also print diffstat from commit.
|
||||||
* `--oneline`:
|
* `--oneline`:
|
||||||
Print only one line per commit.
|
Print only one line per commit.
|
||||||
* `-1`, `--max-count`:
|
* `-1`:
|
||||||
Print only one or a specified number of commits.
|
Print only one commit.
|
||||||
|
* `-n`, `--max-count`:
|
||||||
|
Print only a specified number of commits.
|
||||||
|
|
||||||
### `migrate` [*`options`*] *`formula`*
|
### `migrate` [*`options`*] *`formula`*
|
||||||
|
|
||||||
|
@ -428,8 +428,12 @@ Also print diffstat from commit\.
|
|||||||
Print only one line per commit\.
|
Print only one line per commit\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fB\-1\fR, \fB\-\-max\-count\fR
|
\fB\-1\fR
|
||||||
Print only one or a specified number of commits\.
|
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"
|
.SS "\fBmigrate\fR [\fIoptions\fR] \fIformula\fR"
|
||||||
Migrate renamed packages to new names, where \fIformula\fR are old names of packages\.
|
Migrate renamed packages to new names, where \fIformula\fR are old names of packages\.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user