aboutsummaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-11-20 23:47:10 -0800
committerJunio C Hamano <gitster@pobox.com>2009-11-20 23:47:10 -0800
commit1a02a85d63f280ffaec6977ed2365be92cb80287 (patch)
treefc0cb889551b7c6f297a7a72508357397a4de451 /builtin-log.c
parentaa437791d8b3d5a163777d1cabd1f299654ce712 (diff)
parent2cfa8330e414bc73b01d45f232f8566afc56dd10 (diff)
downloadgit-1a02a85d63f280ffaec6977ed2365be92cb80287.tar.gz
git-1a02a85d63f280ffaec6977ed2365be92cb80287.tar.xz
Merge branch 'bg/format-patch-doc-update'
* bg/format-patch-doc-update: format-patch: Add "--no-stat" as a synonym for "-p" format-patch documentation: Fix formatting format-patch documentation: Remove diff options that are not useful format-patch: Always generate a patch
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/builtin-log.c b/builtin-log.c
index ef5b3c3ae..33fa6ea6c 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -927,10 +927,11 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
PARSE_OPT_NOARG | PARSE_OPT_NONEG, keep_callback },
OPT_BOOLEAN(0, "no-binary", &no_binary_diff,
"don't output binary diffs"),
- OPT_BOOLEAN('p', NULL, &use_patch_format,
- "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"),
+ { OPTION_BOOLEAN, 'p', "no-stat", &use_patch_format, NULL,
+ "show patch format instead of default (patch + stat)",
+ PARSE_OPT_NONEG | PARSE_OPT_NOARG },
OPT_GROUP("Messaging"),
{ OPTION_CALLBACK, 0, "add-header", NULL, "header",
"add email header", PARSE_OPT_NONEG,
@@ -1036,11 +1037,20 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
if (argc > 1)
die ("unrecognized argument: %s", argv[1]);
- if (use_patch_format)
- rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
- else if (!rev.diffopt.output_format ||
- rev.diffopt.output_format == DIFF_FORMAT_PATCH)
- rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH;
+ if (rev.diffopt.output_format & DIFF_FORMAT_NAME)
+ die("--name-only does not make sense");
+ if (rev.diffopt.output_format & DIFF_FORMAT_NAME_STATUS)
+ die("--name-status does not make sense");
+ if (rev.diffopt.output_format & DIFF_FORMAT_CHECKDIFF)
+ die("--check does not make sense");
+
+ if (!use_patch_format &&
+ (!rev.diffopt.output_format ||
+ rev.diffopt.output_format == DIFF_FORMAT_PATCH))
+ rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY;
+
+ /* Always generate a patch */
+ rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
if (!DIFF_OPT_TST(&rev.diffopt, TEXT) && !no_binary_diff)
DIFF_OPT_SET(&rev.diffopt, BINARY);