Re: [PATCH v16 Part II 1/8] bisect--helper: `bisect_reset` shell function in C
- From
Pranit Bauva <pranit.bauva@gmail.com>
- Date
- Oct 30, 2017, 17:27 UTC
- Message-ID
- <CAFZEwPN2GpFy6r1vRpS6oB-qC0r5ymGB_q0AJWueLPyGj7-uvw@mail.gmail.com>
- In-Reply-To
- <7d978e14-2eec-23b9-c25f-e6b361101b03@gmx.net>
Hey Stephan,
On Mon, Oct 30, 2017 at 6:52 PM, Stephan Beyer <s-beyer@gmx.net> wrote:
Show 19 quoted lines
> Hi Pranit,
>> +static int bisect_reset(const char *commit)
>> +{
>> + struct strbuf branch = STRBUF_INIT;
>> +
>> + if (!commit) {
>> + if (strbuf_read_file(&branch, git_path_bisect_start(), 0) < 1)
>> + return !printf(_("We are not bisecting.\n"));
>
> This is weird; I had to look up the return value of printf first before
> I could understand what you are doing ;) I think that it is meant as a
> shortcut for
>
> printf(_("We are not bisecting.\n"));
> return 0;
>
> but please also express it with these two lines. (Or what is the point
> of returning a non-zero value only in the case when nothing could be
> printed?)I was just being a little lazy I suppose. I will stick to doing it in two lines and avoiding fancy things.
Regards, Pranit Bauva