Re: [PATCH 3/3] cat-file: handle streaming failures consistently
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 31, 2018, 14:23 UTC
- Message-ID
- <xmqqva5iurd7.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20181031133341.GA5070@tor.lan>
Torsten Bögershausen <tboegi@web.de> writes:
>> +static int stream_blob(const struct object_id *oid) > > Sorry for nit-picking: > could this be renamed into stream_blob_to_stdout() ?
I think that name makes sense, even though stream_blob() is just fine for a fuction that takes a single parameter oid, as there is no other sane choice than streaming to the standard output stream the blob data.
Show 5 quoted lines
>> +{
>> + if (stream_blob_to_fd(1, oid, NULL, 0))
>
> And I wonder if we could make things clearer:
> s/1/STDOUT_FILENO/What would benefit from symbolic constant more in that function call may be CAN_SEEK thing, but s/1/STDOUT_FILENO/ adds negative value to that line, I would think. The name of the function already makes it clear this is sending the output to a file descriptor, and an integer 1 that specifies a file descriptor cannot mean anything other than the standard output stream.