From: Junio C Hamano <gitster@pobox.com>
To: Miriam Rubio <mirucam@gmail.com>
Cc: git@vger.kernel.org, Tanushree Tumane <tanushreetumane@gmail.com>,
Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH v2 3/4] bisect--helper: reimplement `bisect_run` shell function in C
Date: Thu, 08 Apr 2021 23:15:07 -0700 [thread overview]
Message-ID: <xmqq8s5snfv8.fsf@gitster.g> (raw)
In-Reply-To: <20210407173334.68222-4-mirucam@gmail.com> (Miriam Rubio's message of "Wed, 7 Apr 2021 19:33:32 +0200")
Miriam Rubio <mirucam@gmail.com> writes:
> +static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
> +{
> ...
> + while (1) {
> + strvec_clear(&args);
> +
> + printf(_("running %s"), command.buf);
> + res = run_command_v_opt(run_args.v, RUN_USING_SHELL);
> +
> + if (res < 0 && res >= 128) {
Sorry for not noticing this total nonsense during my earlier review,
but this condition will never trigger.
I would have noticed it if the style consistently used "order
quantities from left to right, as if on a number line" convention,
i.e.
if (res < 0 && 128 <= res) {
Because there are only two valid range notation around a single
variable, which are:
(res < 0 || 128 <= res) - meaning 'res' is outside a span, or
(0 <= res && res < 128) - meaning 'res' is inside a span.
and the above rewriten form is neither, it would have stood out
as an error immediately.
next prev parent reply other threads:[~2021-04-09 6:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-07 17:33 [PATCH v2 0/4] Finish converting git bisect to C part 4 Miriam Rubio
2021-04-07 17:33 ` [PATCH v2 1/4] run-command: make `exists_in_PATH()` non-static Miriam Rubio
2021-04-08 11:22 ` Đoàn Trần Công Danh
2021-04-08 17:38 ` Junio C Hamano
2021-04-07 17:33 ` [PATCH v2 2/4] bisect--helper: reimplement `bisect_visualize()`shell function in C Miriam Rubio
2021-04-07 21:37 ` Junio C Hamano
2021-04-07 17:33 ` [PATCH v2 3/4] bisect--helper: reimplement `bisect_run` shell " Miriam Rubio
2021-04-07 22:09 ` Junio C Hamano
2021-04-11 10:04 ` Miriam R.
2021-04-09 6:15 ` Junio C Hamano [this message]
2021-04-07 17:33 ` [PATCH v2 4/4] bisect--helper: retire `--bisect-next-check` subcommand Miriam Rubio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq8s5snfv8.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=mirucam@gmail.com \
--cc=tanushreetumane@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.