Re: [PATCH v14 21/27] bisect--helper: `bisect_log` shell function in C
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 26, 2016, 23:07 UTC
- Message-ID
- <xmqqbn0fdt9e.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <01020156b73fe6d5-6a363195-eb91-48a0-9a3c-3159fba6d327-000000@eu-west-1.amazonses.com>
Pranit Bauva <pranit.bauva@gmail.com> writes:
Show 14 quoted lines
> +static int bisect_log(void)
> +{
> + struct strbuf buf = STRBUF_INIT;
> +
> + if (strbuf_read_file(&buf, git_path_bisect_log(), 256) < 0) {
> + strbuf_release(&buf);
> + return error(_("We are not bisecting.\n"));
> + }
> +
> + printf("%s", buf.buf);
> + strbuf_release(&buf);
> +
> + return 0;
> +}Hmph, is it really necessary to slurp everything in a strbuf before sending it out to the standard output? Wouldn't it be sufficient to open a file descriptor for reading on the log file and then hand it over to copy.c::copy_fd()?