git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] shortlog: take the first populated line of the description
@ 2008-03-05 14:24 Andy Whitcroft
  2008-03-05 14:48 ` Johannes Schindelin
  2008-03-05 18:47 ` Nicolas Pitre
  0 siblings, 2 replies; 8+ messages in thread
From: Andy Whitcroft @ 2008-03-05 14:24 UTC (permalink / raw)
  To: git


Way back the perl version of shortlog would take the first populated line
of the commit body.  The builtin version mearly takes the first line.
This leads to empty shortlog entries when there is some viable text in
the commit.

Reinstate this behaviour igoring all lines with nothing but whitespace.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---

	This seems to be an improvement, returning to the original
	behaviour.  I cannot think of any good reason not to take the first
	populated line for a shortlog.	The alternative less agressive
	compromise might be to skip only completly empty lines at the
	start, but I am not sure that adds any value.

	I seem to get a lot of these in converted SVN commits.

	Comments?

	-apw
---
 builtin-shortlog.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index af31aba..b22b0ed 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -70,11 +70,12 @@ static void insert_one_record(struct shortlog *log,
 	else
 		free(buffer);
 
+	/* Skip any leading whitespace, including any blank lines. */
+	while (*oneline && isspace(*oneline))
+		oneline++;
 	eol = strchr(oneline, '\n');
 	if (!eol)
 		eol = oneline + strlen(oneline);
-	while (*oneline && isspace(*oneline) && *oneline != '\n')
-		oneline++;
 	if (!prefixcmp(oneline, "[PATCH")) {
 		char *eob = strchr(oneline, ']');
 		if (eob && (!eol || eob < eol))

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

end of thread, other threads:[~2008-03-05 22:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-05 14:24 [PATCH] shortlog: take the first populated line of the description Andy Whitcroft
2008-03-05 14:48 ` Johannes Schindelin
2008-03-05 16:43   ` Andy Whitcroft
2008-03-05 16:51     ` Johannes Schindelin
2008-03-05 18:47 ` Nicolas Pitre
2008-03-05 21:27   ` Junio C Hamano
2008-03-05 21:47     ` Nicolas Pitre
2008-03-05 22:14       ` Junio C Hamano

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 NNTP newsgroup(s).