Re: [PATCH] checkout: add --progress option

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

 



I just noticed something interesting.

On Sat, Oct 31, 2015 at 11:42 AM, Edmundo Carmona Antoranz
<eantoranz@xxxxxxxxx> wrote:
> On Sat, Oct 31, 2015 at 11:37 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> I do find what Peff showed us a lot easier to follow.
>>
>>         if (opts.show_progress < 0) {
>>                 if (opts.quiet)
>>                         opts.show_progress = 0;
>>                 else
>>                         opts.show_progress = isatty(2);
>>         }
>>
>
> Ok.... let me rewrite it that way. Other than that, the other things are ok?

In Peff's implementation I think he uses -1 as --no-progress, 1 as
--progress and 0 as undefined, right?

In my implementation I'm using -1 as undefined and 0 as --no-progress.
What would be the standard approach? From what I can see on
parse_options's behavior, if you select --no-progress, the variable
ends up with a 0, which makes me think I'm using the right approach.

End result with my assumptions would be:

        if (opts.show_progress) {
                /* user selected --progress or didn't specify */
                if (opts.quiet) {
                        opts.show_progress = 0;
                } else if (opts.show_progress < 0) {
                        opts.show_progress = isatty(2);
                }
        }
--
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]