From: Junio C Hamano <gitster@pobox.com>
To: Miriam Rubio <mirucam@gmail.com>
Cc: git@vger.kernel.org, Pranit Bauva <pranit.bauva@gmail.com>,
Lars Schneider <larsxschneider@gmail.com>,
Christian Couder <chriscool@tuxfamily.org>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Tanushree Tumane <tanushreetumane@gmail.com>
Subject: Re: [PATCH v6 06/13] bisect--helper: reimplement `bisect_next` and `bisect_auto_next` shell functions in C
Date: Sat, 29 Aug 2020 12:31:17 -0700 [thread overview]
Message-ID: <xmqq8sdxi70a.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: 20200828124617.60618-7-mirucam@gmail.com
Miriam Rubio <mirucam@gmail.com> writes:
> diff --git a/bisect.c b/bisect.c
> index c6aba2b9f2..f0fca5c6f3 100644
> --- a/bisect.c
> +++ b/bisect.c
> @@ -988,6 +988,12 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
> * the bisection process finished successfully.
> * In this case the calling function or command should not turn a
> * BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND return code into an error or a non zero exit code.
> + *
> + * Checking BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND
> + * in bisect_helper::bisect_next() and only transforming it to 0 at
> + * the end of bisect_helper::cmd_bisect__helper() helps bypassing
> + * all the code related to finding a commit to test.
> + *
> * If no_checkout is non-zero, the bisection process does not
> * checkout the trial commit but instead simply updates BISECT_HEAD.
> */
Not a problem introduced by this step, but the above description on
no_checkout describes a parameter that no longer exists.
The comments before a function is to guide the developers how to
call the function correctly, so it should have been removed, moved
to where no_checkout is used in the function, or moved to where
BISECT_HEAD ref gets created, as necessary, but by mistake be5fe200
(cmd_bisect__helper: defer parsing no-checkout flag, 2020-08-07),
forgot to do any of the three.
> +static enum bisect_error bisect_next(struct bisect_terms *terms, const char *prefix)
> +{
> + int no_checkout;
> + enum bisect_error res;
> +
> + bisect_autostart(terms);
> + if (bisect_next_check(terms, terms->term_good))
> + return BISECT_FAILED;
> +
> + no_checkout = ref_exists("BISECT_HEAD");
> +
> + /* Perform all bisection computation */
> + res = bisect_next_all(the_repository, prefix);
> +
> + if (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND) {
> + res = bisect_successful(terms);
> + return res ? res : BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND;
> + } else if (res == BISECT_ONLY_SKIPPED_LEFT) {
> + res = bisect_skipped_commits(terms);
> + return res ? res : BISECT_ONLY_SKIPPED_LEFT;
> + }
> + return res;
> +}
> +
The no_checkout local variable is assigned but never used. It is
understandable if a variable that used to be used becomes unused
when some part (i.e. the part that used to use the variable) of a
function is factored out, but it is rather unusual how a brand new
function has such an unused code and stay to be that way throughout
a topic. Makes a reviewer suspect that there may be a code missing,
that has to use the variable to decide to do things differently, in
this function. It seems to break -Werror builds.
Thanks.
next prev parent reply other threads:[~2020-08-29 19:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-28 12:46 [PATCH v6 00/13] Finish converting git bisect to C part 2 Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 01/13] bisect--helper: BUG() in cmd_*() on invalid subcommand Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 02/13] bisect--helper: use '-res' in 'cmd_bisect__helper' return Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 03/13] bisect--helper: introduce new `write_in_file()` function Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 04/13] bisect--helper: reimplement `bisect_autostart` shell function in C Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 05/13] bisect: call 'clear_commit_marks_all()' in 'bisect_next_all()' Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 06/13] bisect--helper: reimplement `bisect_next` and `bisect_auto_next` shell functions in C Miriam Rubio
2020-08-29 19:31 ` Junio C Hamano [this message]
2020-08-31 10:50 ` Miriam R.
2020-08-31 17:09 ` Junio C Hamano
2020-08-28 12:46 ` [PATCH v6 07/13] bisect--helper: finish porting `bisect_start()` to C Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 08/13] bisect--helper: retire `--bisect-clean-state` subcommand Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 09/13] bisect--helper: retire `--next-all` subcommand Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 10/13] bisect--helper: reimplement `bisect_state` & `bisect_head` shell functions in C Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 11/13] bisect--helper: retire `--check-expected-revs` subcommand Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 12/13] bisect--helper: retire `--write-terms` subcommand Miriam Rubio
2020-08-28 12:46 ` [PATCH v6 13/13] bisect--helper: retire `--bisect-autostart` subcommand Miriam Rubio
2020-08-29 19:31 ` [PATCH v6 00/13] Finish converting git bisect to C part 2 Junio C Hamano
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=xmqq8sdxi70a.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=larsxschneider@gmail.com \
--cc=mirucam@gmail.com \
--cc=pranit.bauva@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).