format-patch: Add "--no-stat" as a synonym for "-p"
PATCH 4/4 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.
---
This patch is new.
Unfortunately, we must allow --no-stat and --stat (or alternatively complicate the implementation to allow -p and --stat, but not --no-stat and --stat). If that seems too strange, perhaps we are better off without this patch.
Documentation/diff-options.txt | 1 + builtin-log.c | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
Documentation/diff-options.txt +1 -0
@@ -14,6 +14,7 @@ endif::git-format-patch[] ifdef::git-format-patch[] -p:: +--no-stat Generate plain patches without any diffstats. endif::git-format-patch[]
builtin-log.c +1 -1
@@ -925,7 +925,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) "show patch format instead of default (patch + stat)"),OPT_BOOLEAN (0 ,"ignore-if-in-upstream" , &ignore_if_in_upstream,"don't include a patch matching a commit upstream" ), -OPT_BOOLEAN ('p' ,NULL , &use_patch_format, +OPT_BOOLEAN ('p' ,"no-stat" , &use_patch_format,"show patch format instead of default (patch + stat)" ),OPT_GROUP ("Messaging" ), { OPTION_CALLBACK, 0, "add-header", NULL, "header",
Signature · 1 line
1.6.5.1.69.g36942
builtin-log.c int cmd_format_patch(int argc, const char **argv, const char *prefix) · line 931
Quoted 13 lines · Björn Gustavsson
builtin-log.c +1
-1@@ -925,7 +925,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) "show patch format instead of default (patch + stat)"),OPT_BOOLEAN (0 ,"ignore-if-in-upstream" , &ignore_if_in_upstream,"don't include a patch matching a commit upstream" ), -OPT_BOOLEAN ('p' ,NULL , &use_patch_format, +OPT_BOOLEAN ('p' ,"no-stat" , &use_patch_format,"show patch format instead of default (patch + stat)" ),OPT_GROUP ("Messaging" ), { OPTION_CALLBACK, 0, "add-header", NULL, "header",
I think this needs to have the OPT_NO_NEG flag so users can't say --no-no-stat.
2009/11/9 Stephen Boyd <[email protected]>:
Quoted 5 lines
Quoted 2 lines
- OPT_BOOLEAN('p', NULL,
&use_patch_format,
+ OPT_BOOLEAN('p', "no-stat",&use_patch_format,I think this needs to have the
OPT_NO_NEGflag so users can't say --no-no-stat.
Thanks! I didn't know about that.
Signature · 1 line
Björn Gustavsson, Erlang/OTP, Ericsson AB