Re: [PATCH 4/4] bisect--helper: `bisect_reset` shell function in C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 8, 2016 at 9:20 AM, Pranit Bauva <pranit.bauva@xxxxxxxxx> wrote:
> On Wed, Jun 8, 2016 at 1:29 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>> On Tue, Jun 7, 2016 at 4:54 PM, Pranit Bauva <pranit.bauva@xxxxxxxxx> wrote:
>>> +       if (!file_exists(git_path_bisect_head())) {
>>> +               struct argv_array argv = ARGV_ARRAY_INIT;
>>> +               argv_array_pushl(&argv, "checkout", branch.buf, "--", NULL);
>>> +               status = run_command_v_opt(argv.argv, RUN_GIT_CMD);
>>> +               argv_array_clear(&argv);
>>> +       }
>>> +
>>> +       if (status) {
>>
>> What's the purpose of having this 'status' conditional outside of the
>> above !file_exists() conditional, which is the only place that
>> 'status' gets assigned. Likewise, 'status' itself could be declared
>> within the scope of that conditional block.
>
> I wanted to avoid nesting. In a few other parts of the code also,
> nesting is avoided as much as possible.

I figured as much, but I'm not sure that that is such a good idea in
this case since it makes the code more difficult to reason about. To
wit: as a reader of the code, I spent extra time trying to figure why
it was structured this way and if 'status' is assigned or accessed in
some other non-obvious way.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]