Re: [PATCH] remove "[PATCH]" prefix from shortlog output
- From
Junio C Hamano <junkio@cox.net>
- Date
- Dec 10, 2006, 23:32 UTC
- Message-ID
- <7vac1v2uom.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.63.0612102337090.28348@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> It tries not only to strip "[PATCH]", but also "[PATCH 0/n]" and basically > every prefix beginning with "[PATCH" and ending in "]". I do not remember > if I really tested that code, but it should work.
The problem is that you forgot that the lines are indented when acting as a filter.
How about this? It also contains the extra whitespace removal from the author name.
diff --git a/builtin-shortlog.c b/builtin-shortlog.c index 7a2ddfe..3fc43dd 100644 --- a/builtin-shortlog.c +++ b/builtin-shortlog.c @@ -188,18 +188,25 @@ static void read_from_stdin(struct path_list *list) bob = buffer + strlen(buffer); else { offset = 8; - if (isspace(bob[-1])) + while (buffer + offset < bob && + isspace(bob[-1])) bob--; } while (fgets(buffer2, sizeof(buffer2), stdin) && buffer2[0] != '\n') ; /* chomp input */ - if (fgets(buffer2, sizeof(buffer2), stdin)) + if (fgets(buffer2, sizeof(buffer2), stdin)) { + int l2 = strlen(buffer2); + int i; + for (i = 0; i < l2; i++) + if (!isspace(buffer2[i])) + break; insert_author_oneline(list, buffer + offset, bob - buffer - offset, - buffer2, strlen(buffer2)); + buffer2 + i, l2 - i); + } } } }