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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux