Subject: Re: [PATCH] format-patch: use default diff format even with patch options

From: Junio C Hamano <[email-masked]>
Date: Sun, 24 Aug 2008 21:57:55 -0700

Jeff King <[email-masked]> writes:

> I am a little uncomfortable hurting anyone who thought that
> "format-patch -p" was a good idea. OTOH:
>
>   1. I have to question why they were using format-patch in the first
>      place. Probably git-log --pretty=email would be a better fit.
>
>   2. Their mails were already broken, since the presence of the diffstat
>      is what triggers the "---" divider.
>
>  builtin-log.c           |    3 ++-
>  t/t4014-format-patch.sh |   25 +++++++++++++++++++++++++
>  2 files changed, 27 insertions(+), 1 deletions(-)
>
> diff --git a/builtin-log.c b/builtin-log.c
> index 9204ffd..1d3c5cb 100644
> --- a/builtin-log.c
> +++ b/builtin-log.c
> @@ -932,7 +932,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
>  	if (argc > 1)
>  		die ("unrecognized argument: %s", argv[1]);
>  
> -	if (!rev.diffopt.output_format)
> +	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)

I think this is the right thing to do.  The only unusual option somebody
might want to use would be "format-patch --stat $range" to send out commit
log e-mails with diffstat summary but without the actual patch, but your
change does not break that use case either.