stripspace: incomplete line fix (take #2)

This fixes f4ee3eb689 breakage, which
added an extra trailing blank line after stripping trailing blank lines
by mistake.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2006-04-14 12:41:51 -07:00
parent dfdcb558ec
commit 5cf7e21fbc

View File

@ -12,7 +12,9 @@ static int cleanup(char *line)
{
int len = strlen(line);
if (len > 1 && line[len-1] == '\n') {
if (len && line[len-1] == '\n') {
if (len == 1)
return 0;
do {
unsigned char c = line[len-2];
if (!isspace(c))