git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Alex Henrie <alexhenrie24@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Git mailing list" <git@vger.kernel.org>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [PATCH v2] switch: mention the --detach option when dying due to lack of a branch
Date: Fri, 25 Feb 2022 10:20:08 -0700	[thread overview]
Message-ID: <CAMMLpeTSMzx4mFjV-fQtbqo1cPfME_ekRO5Xt5TQaKGj0fmNxQ@mail.gmail.com> (raw)
In-Reply-To: <220225.86h78n88gb.gmgdl@evledraar.gmail.com>

On Fri, Feb 25, 2022 at 4:57 AM Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
>
> On Thu, Feb 24 2022, Junio C Hamano wrote:
>
> > Alex Henrie <alexhenrie24@gmail.com> writes:
> >> diff --git a/t/t2060-switch.sh b/t/t2060-switch.sh
> >> index ebb961be29..f54691bac9 100755
> >> --- a/t/t2060-switch.sh
> >> +++ b/t/t2060-switch.sh
> >> @@ -32,6 +32,17 @@ test_expect_success 'switch and detach' '
> >>      test_must_fail git symbolic-ref HEAD
> >>  '
> >>
> >> +test_expect_success 'suggestion to detach' '
> >> +    test_must_fail git switch main^{commit} 2>stderr &&
> >> +    test_i18ngrep "try again with the --detach option" stderr
> >> +'
> >> +
> >> +test_expect_success 'suggestion to detach is suppressed with advice.suggestDetachingHead=false' '
> >> +    test_config advice.suggestDetachingHead false &&
> >> +    test_must_fail git switch main^{commit} 2>stderr &&
> >> +    test_i18ngrep ! "try again with the --detach option" stderr
> >> +'
> >
> > OK, we try to be consistent with other tests in the file, and leave
> > s/test_i18n// to a file-wide clean-up outside the topic.
>
> FWIW that's not the case here. This is the first use of test_i18ngrep in
> this file.
>
> But better to use test_cmp as noted in
> <220224.86sfs8abj6.gmgdl@evledraar.gmail.com> in the sid-thread.

Why is test_cmp preferable to grep in tests like this?

-Alex

  reply	other threads:[~2022-02-25 17:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24  6:47 [PATCH v2] switch: mention the --detach option when dying due to lack of a branch Alex Henrie
2022-02-24  8:53 ` Ævar Arnfjörð Bjarmason
2022-02-24 19:02 ` Junio C Hamano
2022-02-25 11:57   ` Ævar Arnfjörð Bjarmason
2022-02-25 17:20     ` Alex Henrie [this message]
2022-02-25 17:26     ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMMLpeTSMzx4mFjV-fQtbqo1cPfME_ekRO5Xt5TQaKGj0fmNxQ@mail.gmail.com \
    --to=alexhenrie24@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).