Merge branch 'jk/maint-format-patch-p-suppress-stat'
authorJunio C Hamano <gitster@pobox.com>
Tue, 10 Nov 2009 20:35:56 +0000 (12:35 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Nov 2009 20:35:56 +0000 (12:35 -0800)
* jk/maint-format-patch-p-suppress-stat:
format-patch: make "-p" suppress diffstat

1  2 
builtin-log.c
diff --combined builtin-log.c
index 207a36178bafcbd755789fefb35b74054d1ff2fa,7b91c914236a8e196190663fdbc3be4581539791..fb5308220dc36ef9324326638dd67756c9930503
@@@ -891,6 -891,7 +891,7 @@@ int cmd_format_patch(int argc, const ch
        struct patch_ids ids;
        char *add_signoff = NULL;
        struct strbuf buf = STRBUF_INIT;
+       int use_patch_format = 0;
        const struct option builtin_format_patch_options[] = {
                { OPTION_CALLBACK, 'n', "numbered", &numbered, NULL,
                            "use [PATCH n/m] even with a single patch",
                            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"),
                OPT_GROUP("Messaging"),
        if (argc > 1)
                die ("unrecognized argument: %s", argv[1]);
  
-       if (!rev.diffopt.output_format
-               || rev.diffopt.output_format == DIFF_FORMAT_PATCH)
+       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 (!DIFF_OPT_TST(&rev.diffopt, TEXT) && !no_binary_diff)
@@@ -1304,9 -1309,8 +1309,9 @@@ int cmd_cherry(int argc, const char **a
  
                if (verbose) {
                        struct strbuf buf = STRBUF_INIT;
 +                      struct pretty_print_context ctx = {0};
                        pretty_print_commit(CMIT_FMT_ONELINE, commit,
 -                                          &buf, 0, NULL, NULL, 0, 0);
 +                                          &buf, &ctx);
                        printf("%c %s %s\n", sign,
                               sha1_to_hex(commit->object.sha1), buf.buf);
                        strbuf_release(&buf);