From: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH 4/6] bisect run: fix the error message
Date: Thu, 15 Dec 2022 22:08:23 +0700 [thread overview]
Message-ID: <Y5s4Zy14TbGalfIl@danh.dev> (raw)
In-Reply-To: <patch-4.6-59a8a3085b1-20221215T094038Z-avarab@gmail.com>
On 2022-12-15 10:47:47+0100, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> In d1bbbe45df8 (bisect--helper: reimplement `bisect_run` shell function
> in C, 2021-09-13), we ported the `bisect run` subcommand to C, including
> the part that prints out an error message when the implicit `git bisect
> bad` or `git bisect good` failed.
>
> However, the error message was supposed to print out whether the state
> was "good" or "bad", but used a bogus (because non-populated) `args`
> variable for it. This was fixed in 80c2e9657f2 (bisect--helper: report
> actual bisect_state() argument on error, 2022-01-18), but the error
> message still talks about `bisect--helper`, which is an implementation
> detail that should not concern end users.
I don't think the error still talks about `bisect--helper`.
The error is talking about some "bisect-state" which is not it Git's
glossary, though.
> Fix that, and add a regression test to ensure that the intended form of
> the error message.
>
> Helped-by: Elijah Newren <newren@gmail.com>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
> builtin/bisect.c | 2 +-
> t/t6030-bisect-porcelain.sh | 10 ++++++++++
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/bisect.c b/builtin/bisect.c
> index 9fc8db06944..0786ebf4012 100644
> --- a/builtin/bisect.c
> +++ b/builtin/bisect.c
> @@ -1292,7 +1292,7 @@ static int bisect_run(struct bisect_terms *terms, int argc, const char **argv)
> puts(_("bisect found first bad commit"));
> res = BISECT_OK;
> } else if (res) {
> - error(_("bisect run failed: 'bisect-state %s'"
> + error(_("bisect run failed: 'git bisect %s'"
> " exited with error code %d"), new_state, res);
> } else {
> continue;
> diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
> index 9e56b42b5da..0a62ea2b3ce 100755
> --- a/t/t6030-bisect-porcelain.sh
> +++ b/t/t6030-bisect-porcelain.sh
> @@ -1221,4 +1221,14 @@ test_expect_success 'bisect state output with bad commit' '
> grep -F "waiting for good commit(s), bad commit known" output
> '
>
> +test_expect_success 'verify correct error message' '
> + git bisect reset &&
> + git bisect start $HASH4 $HASH1 &&
> + write_script test_script.sh <<-\EOF &&
> + rm .git/BISECT*
> + EOF
> + test_must_fail git bisect run ./test_script.sh 2>error &&
> + grep "git bisect good.*exited with error code" error
> +'
> +
> test_done
> --
> 2.39.0.rc2.1048.g0e5493b8d5b
>
--
Danh
next prev parent reply other threads:[~2022-12-15 15:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 9:47 [PATCH 0/6] bisect: follow-up fixes from js/bisect-in-c Ævar Arnfjörð Bjarmason
2022-12-15 9:47 ` [PATCH 1/6] bisect--helper: simplify exit code computation Ævar Arnfjörð Bjarmason
2022-12-15 9:47 ` [PATCH 2/6] bisect--helper: make the order consistently `argc, argv` Ævar Arnfjörð Bjarmason
2022-12-15 9:47 ` [PATCH 3/6] bisect: verify that a bogus option won't try to start a bisection Ævar Arnfjörð Bjarmason
2022-12-15 9:47 ` [PATCH 4/6] bisect run: fix the error message Ævar Arnfjörð Bjarmason
2022-12-15 15:08 ` Đoàn Trần Công Danh [this message]
2022-12-15 9:47 ` [PATCH 5/6] bisect: remove Cogito-related code Ævar Arnfjörð Bjarmason
2022-12-15 9:47 ` [PATCH 6/6] bisect: no longer try to clean up left-over `.git/head-name` files Ævar Arnfjörð Bjarmason
2022-12-15 10:45 ` [PATCH 0/6] bisect: follow-up fixes from js/bisect-in-c Christian Couder
2023-01-12 15:19 ` [PATCH v2 " Ævar Arnfjörð Bjarmason
2023-01-12 15:19 ` [PATCH v2 1/6] bisect--helper: simplify exit code computation Ævar Arnfjörð Bjarmason
2023-01-12 15:19 ` [PATCH v2 2/6] bisect--helper: make the order consistently `argc, argv` Ævar Arnfjörð Bjarmason
2023-01-12 15:19 ` [PATCH v2 3/6] bisect: verify that a bogus option won't try to start a bisection Ævar Arnfjörð Bjarmason
2023-01-12 15:19 ` [PATCH v2 4/6] bisect run: fix the error message Ævar Arnfjörð Bjarmason
2023-01-12 15:19 ` [PATCH v2 5/6] bisect: remove Cogito-related code Ævar Arnfjörð Bjarmason
2023-01-12 15:19 ` [PATCH v2 6/6] bisect: no longer try to clean up left-over `.git/head-name` files Ævar Arnfjörð Bjarmason
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=Y5s4Zy14TbGalfIl@danh.dev \
--to=congdanhqx@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=newren@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).