diff --git a/Library/Homebrew/cmd/log.rb b/Library/Homebrew/cmd/log.rb index e49d4bead0..03200a7539 100644 --- a/Library/Homebrew/cmd/log.rb +++ b/Library/Homebrew/cmd/log.rb @@ -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 diff --git a/docs/Manpage.md b/docs/Manpage.md index 0a82a3a035..76b1e07c4d 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -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`* diff --git a/manpages/brew.1 b/manpages/brew.1 index ca4926fff2..3f4dcbac10 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -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\.