git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] format-patch: set diffstat width to 70 instead of default 80
@ 2018-01-22 12:31 Nguyễn Thái Ngọc Duy
  2018-01-22 23:13 ` Junio C Hamano
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-01-22 12:31 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Patches or cover letters generated by format-patch are meant to be
exchanged as emails, most of the time. And since it's generally agreed
that text in mails should be wrapped around 70 columns or so, make sure
these diffstat follow the convention.

I noticed this when I quoted a diffstat line [1]. Should we do something
like this? diffstat is rarely quoted though so perhaps the stat width
should be something like 75.

t4052 fails but I don't think it's worth fixing until it's clear if it's
worth doing this.

[1] https://public-inbox.org/git/20180122121426.GD5980@ash/T/#u

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/log.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/builtin/log.c b/builtin/log.c
index 14fdf39165..6be79656c5 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1061,6 +1061,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
 
 	memcpy(&opts, &rev->diffopt, sizeof(opts));
 	opts.output_format = DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
+	opts.diffopt.stat_width = 70;
 
 	diff_setup_done(&opts);
 
@@ -1611,9 +1612,12 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		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 ||
+	     rev.diffopt.output_format == DIFF_FORMAT_PATCH)) {
 		rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY;
+		if (!rev.diffopt.stat_width)
+			rev.diffopt.stat_width = 70;
+	}
 
 	/* Always generate a patch */
 	rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
-- 
2.16.0.47.g3d9b0fac3a


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-02-02 18:42 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 12:31 [PATCH] format-patch: set diffstat width to 70 instead of default 80 Nguyễn Thái Ngọc Duy
2018-01-22 23:13 ` Junio C Hamano
2018-01-22 23:52 ` Jeff King
2018-01-23  0:10   ` Ævar Arnfjörð Bjarmason
2018-01-23  0:12     ` Jeff King
2018-01-23  2:42   ` Duy Nguyen
2018-01-23  0:08 ` Ævar Arnfjörð Bjarmason
2018-01-25 11:59 ` [PATCH v2 0/2] wrap format-patch diffstats around 72 columns Nguyễn Thái Ngọc Duy
2018-01-25 11:59   ` [PATCH v2 1/2] format-patch: keep cover-letter diffstat wrapped in " Nguyễn Thái Ngọc Duy
2018-01-25 11:59   ` [PATCH v2 2/2] format-patch: reduce patch diffstat width to 72 Nguyễn Thái Ngọc Duy
2018-01-27 16:47     ` Jeff King
2018-01-30 10:22       ` Duy Nguyen
2018-01-27 16:48   ` [PATCH v2 0/2] wrap format-patch diffstats around 72 columns Jeff King
2018-02-01 12:47   ` [PATCH v3 " Nguyễn Thái Ngọc Duy
2018-02-01 12:47     ` [PATCH v3 1/2] format-patch: keep cover-letter diffstat wrapped in " Nguyễn Thái Ngọc Duy
2018-02-01 12:47     ` [PATCH v3 2/2] format-patch: reduce patch diffstat width to 72 Nguyễn Thái Ngọc Duy
2018-02-02 18:42     ` [PATCH v3 0/2] wrap format-patch diffstats around 72 columns Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).