Skip to content

Commit 2cfa833

Browse files
bjornggitster
authored andcommitted
format-patch: Add "--no-stat" as a synonym for "-p"
"-p" means "generate patch" in 'git log' and 'git diff', so it's quite surprising that it means "suppress diffstat" in 'git format-patch'. Keep the "-p" option for backward compatibility, but add "--no-stat" as a more intuitive synonym. For backward compatibility with scripts, we must allow combinations of --stat and --no-stat. Signed-off-by: Björn Gustavsson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dce5ef1 commit 2cfa833

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Documentation/diff-options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ endif::git-format-patch[]
1414

1515
ifdef::git-format-patch[]
1616
-p::
17+
--no-stat::
1718
Generate plain patches without any diffstats.
1819
endif::git-format-patch[]
1920

builtin-log.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
923923
"don't output binary diffs"),
924924
OPT_BOOLEAN(0, "ignore-if-in-upstream", &ignore_if_in_upstream,
925925
"don't include a patch matching a commit upstream"),
926-
OPT_BOOLEAN('p', NULL, &use_patch_format,
927-
"show patch format instead of default (patch + stat)"),
926+
{ OPTION_BOOLEAN, 'p', "no-stat", &use_patch_format, NULL,
927+
"show patch format instead of default (patch + stat)",
928+
PARSE_OPT_NONEG | PARSE_OPT_NOARG },
928929
OPT_GROUP("Messaging"),
929930
{ OPTION_CALLBACK, 0, "add-header", NULL, "header",
930931
"add email header", PARSE_OPT_NONEG,

0 commit comments

Comments
 (0)