git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Daniel Barkalow <barkalow@iabervon.org>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: [PATCH 2/2] format-patch: wrap cover-letter's shortlog sensibly
Date: Sun, 2 Mar 2008 15:53:39 +0000 (GMT)	[thread overview]
Message-ID: <alpine.LSU.1.00.0803021553090.22527@racer.site> (raw)
In-Reply-To: <alpine.LSU.1.00.0803021552210.22527@racer.site>


Earlier, overly-long onelines would not be wrapped at all, and indented
with 6 spaces.

Instead, we now wrap around at 72 characters, with a first-line indent
of 2 spaces, and the rest with 4 spaces (like the "What's in" messages
of Junio).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 builtin-log.c                                      |    4 ++++
 ...tch_--stdout_--cover-letter_-n_initial..master^ |    4 ++--
 t/t4014-format-patch.sh                            |   19 +++++++++++++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index fd9b3ae..fe8fc6f 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -683,6 +683,10 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
 	strbuf_release(&sb);
 
 	shortlog_init(&log);
+	log.wrap_lines = 1;
+	log.wrap = 72;
+	log.in1 = 2;
+	log.in2 = 4;
 	for (i = 0; i < nr; i++)
 		shortlog_add_commit(&log, list[i]);
 
diff --git a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^
index 0151453..8dab4bf 100644
--- a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^
+++ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^
@@ -7,8 +7,8 @@ Subject: [DIFFERENT_PREFIX 0/2] *** SUBJECT HERE ***
 *** BLURB HERE ***
 
 A U Thor (2):
-      Second
-      Third
+  Second
+  Third
 
  dir/sub |    4 ++++
  file0   |    3 +++
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 6d86b7d..b2b7a8d 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -211,4 +211,23 @@ test_expect_success 'cover-letter inherits diff options' '
 	grep "file => foo .* 0 *$" 0000-cover-letter.patch
 
 '
+
+cat > expect << EOF
+  This is an excessively long subject line for a message due to the
+    habit some projects have of not having a short, one-line subject at
+    the start of the commit message, but rather sticking a whole
+    paragraph right at the start as the only thing in the commit
+    message. It had better not become the filename for the patch.
+  foo
+
+EOF
+
+test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
+
+	git format-patch --cover-letter -2 &&
+	sed -e "1,/A U Thor/d" -e "/^$/q" < 0000-cover-letter.patch > output &&
+	git diff expect output
+
+'
+
 test_done
-- 
1.5.4.3.510.g7cdd



  parent reply	other threads:[~2008-03-02 15:55 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-29  1:44 [PATCH 0/5] Builtin "git remote" Johannes Schindelin
2008-02-29  1:44 ` [PATCH 1/5] path-list: add functions to work with unsorted lists Johannes Schindelin
2008-02-29  2:04   ` Junio C Hamano
2008-02-29  2:15     ` Johannes Schindelin
2008-03-01 13:14       ` [PATCH 0/6] Builtin remote, v2 Johannes Schindelin
2008-03-01 13:15         ` [PATCH 1/6] Rename path_list to string_list Johannes Schindelin
2008-03-11 16:20           ` David Kågedal
2008-03-11 16:26             ` Johannes Schindelin
2008-03-11 16:44               ` David Kågedal
2008-03-01 13:15         ` [PATCH 2/6] string-list: add functions to work with unsorted lists Johannes Schindelin
2008-03-01 13:16         ` [PATCH 3/6] parseopt: add flag to stop on first non option Johannes Schindelin
2008-03-01 13:16         ` [PATCH 4/6] Test "git remote show" and "git remote prune" Johannes Schindelin
2008-03-01 13:16         ` [PATCH 5/6] Make git-remote a builtin Johannes Schindelin
2008-03-01 13:17         ` [PATCH 6/6] builtin-remote: prune remotes correctly that were added with --mirror Johannes Schindelin
2008-02-29  1:45 ` [PATCH 2/5] parseopt: add flag to stop on first non option Johannes Schindelin
2008-02-29  1:45 ` [PATCH 3/5] Test "git remote show" and "git remote prune" Johannes Schindelin
2008-02-29  1:45 ` [PATCH 4/5] Make git-remote a builtin Johannes Schindelin
2008-02-29  1:46 ` [PATCH 5/5] builtin-remote: prune remotes correctly that were added with --mirror Johannes Schindelin
2008-02-29  1:56 ` [PATCH 0/5] Builtin "git remote" Junio C Hamano
2008-02-29  2:13   ` Johannes Schindelin
2008-02-29  2:17   ` Daniel Barkalow
2008-02-29 11:21     ` Johannes Schindelin
2008-03-02 15:15       ` Johannes Schindelin
2008-03-02 15:40         ` Johannes Schindelin
2008-03-02 15:52           ` [PATCH 0/2] format-patch --cover-letter improvements Johannes Schindelin
2008-03-02 15:53             ` [PATCH 1/2] format-patch: use the diff options for the cover letter, too Johannes Schindelin
2008-03-02 15:53             ` Johannes Schindelin [this message]
2008-03-02 17:05               ` [PATCH 2/2] format-patch: wrap cover-letter's shortlog sensibly Junio C Hamano
2008-03-02 17:38                 ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.1.00.0803021553090.22527@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).