git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix strbuf take #2
@ 2005-05-19  6:34 Junio C Hamano
  0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2005-05-19  6:34 UTC (permalink / raw)
  To: torvalds; +Cc: git

I just remembered why I placed that bogus "sb->len ==0 implies
sb->eof" condition there.  We need at least something like this
to catch the normal EOF (that is, line termination immediately
followed by EOF) case.  "if (feof(fp))" fires when we have
already read the eof, not when we are about read it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
git-diff-cache -r -z 0 | ./git-diff-helper -z
diff --git a/strbuf.c b/strbuf.c
--- a/strbuf.c
+++ b/strbuf.c
@@ -37,6 +37,8 @@ void read_line(struct strbuf *sb, FILE *
 			break;
 		strbuf_add(sb, ch);
 	}
+	if (ch == EOF && sb->len == 0)
+		sb->eof = 1;
 	strbuf_end(sb);
 }
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-05-19  6:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-19  6:34 [PATCH] fix strbuf take #2 Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).