From: Robert Shearman <rob@codeweavers.com>
To: git@vger.kernel.org
Subject: [PATCH] format-patch: Generate a newline between the subject header and the message body
Date: Thu, 13 Jul 2006 23:17:22 +0100 [thread overview]
Message-ID: <44B6C672.9090300@codeweavers.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 398 bytes --]
format-patch previously didn't generate a newline after a subject. This
caused the diffstat to not be displayed in messages with only one line
for the commit message.
This patch fixes this by adding a newline after the headers if a body
hasn't been added.
Signed-off-by: Robert Shearman <rob@codeweavers.com>
---
commit.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
[-- Attachment #2: e4ec67def0af32e4a1704ce5ad941c81136b34e8.diff --]
[-- Type: text/x-patch, Size: 884 bytes --]
diff --git a/commit.c b/commit.c
index 522a6f3..6ac3bf7 100644
--- a/commit.c
+++ b/commit.c
@@ -655,6 +655,9 @@ unsigned long pretty_print_commit(enum c
continue;
}
+ if (!subject)
+ body = 1;
+
if (is_empty_line(line, &linelen)) {
if (!body)
continue;
@@ -662,8 +665,6 @@ unsigned long pretty_print_commit(enum c
continue;
if (fmt == CMIT_FMT_SHORT)
break;
- } else {
- body = 1;
}
if (subject) {
@@ -702,6 +703,12 @@ unsigned long pretty_print_commit(enum c
/* Make sure there is an EOLN for the non-oneline case */
if (fmt != CMIT_FMT_ONELINE)
buf[offset++] = '\n';
+ /*
+ * make sure there is another EOLN to separate the headers from whatever
+ * body the caller appends if we haven't already written a body
+ */
+ if (fmt == CMIT_FMT_EMAIL && !body)
+ buf[offset++] = '\n';
buf[offset] = '\0';
return offset;
}
next reply other threads:[~2006-07-13 22:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-13 22:17 Robert Shearman [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-07-13 12:03 [PATCH] format-patch: Generate a newline between the subject header and the message body Robert Shearman
2006-07-13 19:38 ` Jakub Narebski
2006-07-13 20:03 ` Robert Shearman
2006-07-13 21:31 ` Junio C Hamano
2006-07-13 21:48 ` Junio C Hamano
2006-07-13 21:55 ` Robert Shearman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44B6C672.9090300@codeweavers.com \
--to=rob@codeweavers.com \
--cc=git@vger.kernel.org \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.