From: Andy Whitcroft Date: Wed, 5 Mar 2008 14:24:10 +0000 (+0000) Subject: shortlog: take the first populated line of the description X-Git-Tag: v1.5.5-rc0~53^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c1ce83a5b64618a8a4ac313da82c156558cbe259;p=git.git shortlog: take the first populated line of the description 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. This is often useful when dealing with commits imported from foreign SCMs that do not tidy up the log message of useless blank lines at the beginning. Signed-off-by: Andy Whitcroft Signed-off-by: Junio C Hamano --- diff --git a/builtin-shortlog.c b/builtin-shortlog.c index fa8bc7d02..f08095bc9 100644 --- a/builtin-shortlog.c +++ b/builtin-shortlog.c @@ -74,11 +74,12 @@ static void insert_one_record(struct path_list *list, 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))