aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-04-14 12:41:51 -0700
committerJunio C Hamano <junkio@cox.net>2006-04-14 12:41:51 -0700
commit5cf7e21fbc1819de7975b17f4b19cfdc3a057c1d (patch)
tree56cbaae9d5bf4a2125cab4db3866ec3e8cd8cef5
parentdfdcb558ecf93c0e09b8dab89cff4839e8c95e36 (diff)
downloadgit-5cf7e21fbc1819de7975b17f4b19cfdc3a057c1d.tar.gz
git-5cf7e21fbc1819de7975b17f4b19cfdc3a057c1d.tar.xz
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>
-rw-r--r--stripspace.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/stripspace.c b/stripspace.c
index dee1ef06e..65a634645 100644
--- a/stripspace.c
+++ b/stripspace.c
@@ -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))