Jeff King <p...@peff.net> writes:

> I sometimes find it confusing when there are two variables with very
> similar meanings (option_progress and show_progress here). I wonder if
> we could use one variable, like:
>
>   static int show_progress = -1;
>   ...
>   OPT_BOOL(0, "progress", &show_progress, ...);
>   ...
>   parse_options(...);
>   if (show_progress < 0) {
>       if (opts.quiet)
>               show_progress = 0;
>       else
>               show_progress = isatty(2);
>   }
>
> That somehow is much clearer to me, especially around the behavior of
> "-q --progress". Mine does the opposite of what you wrote above, but I
> think it makes more sense.
>
> I can live with it either way, though. :)

Actually, using a single variable is my preference.  In this case I
wanted to illustrate that the value parsed by parse_options() does
not have to be the one that is used in the final location deep in
the callchain for educational purposes, and I found it clearer to
use two separate variables in the illustration.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to