Re: [PATCH] strbuf: move strbuf_readline_fd() from bundle.c to strbuf.{c,h}
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:03
徐迪 [off-list ref] writes:
-/* Eventually this should go to strbuf.[ch] */
-static int strbuf_readline_fd(struct strbuf *sb, int fd)
-{Unlike other line-oriented input functions in strbuf.c, this hardcodes the LF as the terminator, hence is not capable of reading -z output. As an internal function to the bundle reader implementation, that is perfectly fine, because we know lines in bundle ends with '\n'. But if we were to promote this to a generic API, that aspect of this function needs to be reconsidered, and if we decide to allow non-LF line terminator for consistency with other functions, the current callers in this function have to pass an extra parameter "term" to it. We simply do not have enough datapoint to see if it is worth it to promote this to strbuf.c with such a change, especially when there is no other caller to it. That is why we said "Eventually" here when we introduced this function at e9ee84c (bundle: allowing to read from an unseekable fd, 2011-10-13). I do not think the situation changed yet in any way since then.