{"thread":{"id":"656","subject":"[PATCH] fix strbuf take #2","startedAt":"2005-05-19T06:34:03Z","lastAt":"2005-05-19T06:34:03Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"3533","messageId":"7vhdgzn2qs.fsf@assigned-by-dhcp.cox.net","threadId":"656","inReplyTo":null,"subject":"[PATCH] fix strbuf take #2","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-19T06:34:03Z","receivedAt":"2005-05-19T06:34:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I just remembered why I placed that bogus \"sb->len ==0 implies\nsb->eof\" condition there.  We need at least something like this\nto catch the normal EOF (that is, line termination immediately\nfollowed by EOF) case.  \"if (feof(fp))\" fires when we have\nalready read the eof, not when we are about read it.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\ngit-diff-cache -r -z 0 | ./git-diff-helper -z\ndiff --git a/strbuf.c b/strbuf.c\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -37,6 +37,8 @@ void read_line(struct strbuf *sb, FILE *\n \t\t\tbreak;\n \t\tstrbuf_add(sb, ch);\n \t}\n+\tif (ch == EOF && sb->len == 0)\n+\t\tsb->eof = 1;\n \tstrbuf_end(sb);\n }\n \n\n\n"}]}