@matheusbsbs / matheus-bagliano / commits / 5cf7e21fbc
Fork 0

stripspace: incomplete line fix (take #2)

This fixes f4ee3eb68906f079dea45de4f1bbb03d68189eb3 breakage, which added an extra trailing blank line after stripping trailing blank lines by mistake. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Apr 14, 2006 at 12:41 UTC 5cf7e21fbc1819de7975b17f4b19cfdc3a057c1d
1 file changed +3 -1
stripspace.c
+3 -1
@@ -12,7 +12,9 @@ static int cleanup(char *line)
12 {
13 int len = strlen(line);
14
15 - if (len > 1 && line[len-1] == '\n') {
15 + if (len && line[len-1] == '\n') {
16 + if (len == 1)
17 + return 0;
18 do {
19 unsigned char c = line[len-2];
20 if (!isspace(c))