git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Baruch Burstein <bmburstein@gmail.com>,
	Randall Becker <rsbecker@nexbridge.com>,
	Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Rafael Silva <rafaeloliveira.cs@gmail.com>
Subject: Re: [PATCH 1/2] worktree: send "chatty" messages to stderr
Date: Fri, 3 Dec 2021 08:07:49 -0500	[thread overview]
Message-ID: <CAPig+cQ1+Hm=2jNKais-X6ahKCkG4Xo9Z4WsqTYryETc9a4mTw@mail.gmail.com> (raw)
In-Reply-To: <211203.86fsrat592.gmgdl@evledraar.gmail.com>

On Fri, Dec 3, 2021 at 4:19 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> On Thu, Dec 02 2021, Eric Sunshine wrote:
> >       git worktree add --detach orig &&
> >       sed s,orig/\.git$,moved/.git, .git/worktrees/orig/gitdir >expect &&
> >       mv orig moved &&
> > -     git worktree repair moved >out 2>err &&
> > +     git worktree repair moved 2>err &&
> >       test_cmp expect .git/worktrees/orig/gitdir &&
> > -     test_i18ngrep "gitdir incorrect" out &&
> > -     test_must_be_empty err
> > +     test_i18ngrep "gitdir incorrect" err
> >  '
>
> This is just a "for bonus points", but maybe we could/should while we're
> at it harden and make the tests more exhaustive by checking the full
> output of both, e.g.
>
>         cat >actual.out <<-\EOF &&
>         Preparing worktree (checking out 'bar')
>         EOF
>         cat >actual.err <<-\EOF &&
>         fatal: 'bar' is already checked out at '.../wherever'
>         EOF
>         <cmd> [...]
>         test_cmp expect.out actual.out &&
>         test_cmp expect.err actual.err
>
> Doesn't need a re-roll etc., just if you're interested... :)

To be clear, with the application of the current patch, both of those
messages would need to be in the `actual.err` file, and `actual.out`
would be empty; not one message in each file as in your snippet.

That aside, there's still potentially output which is outside the
control of git-worktree. In the case of this particular negative test,
your suggestion should work, but for a positive test, it would be
harder and uglier (though, of course, not impossible). For instance,
for a successful `git worktree add`, the output is:

    Preparing worktree (new branch 'foobar')
    Updating files: 100% (3993/3993), done.
    HEAD is now at abe6bb3905 Gobbledygook

The subsequent lines come from git-reset (which, by the way, is
sending "HEAD is now at" to stdout, though they probably should be on
stderr, but that's a separate issue).

Anyhow, such a change to the tests should be a separate topic. The
user-facing problem addressed by the current patch series need not be
held up by a behind-the-scenes change to testing.

  reply	other threads:[~2021-12-03 13:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03  3:44 [PATCH 0/2] worktree: fix incorrectly-ordered messages on Windows Eric Sunshine
2021-12-03  3:44 ` [PATCH 1/2] worktree: send "chatty" messages to stderr Eric Sunshine
2021-12-03  9:17   ` Ævar Arnfjörð Bjarmason
2021-12-03 13:07     ` Eric Sunshine [this message]
2021-12-03  3:44 ` [PATCH 2/2] git-worktree.txt: add missing `-v` to synopsis for `worktree list` Eric Sunshine
2021-12-03  9:13   ` Ævar Arnfjörð Bjarmason
2021-12-03 12:48     ` Eric Sunshine
2021-12-03 14:57       ` Ævar Arnfjörð Bjarmason
2021-12-03 15:52         ` Jeff King
2021-12-05  9:12       ` Junio C Hamano
2021-12-06 13:34         ` Eric Sunshine
2021-12-06 15:06           ` Ævar Arnfjörð Bjarmason
2021-12-06 17:53             ` Junio C Hamano
2021-12-11 22:25   ` Rafael Silva

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='CAPig+cQ1+Hm=2jNKais-X6ahKCkG4Xo9Z4WsqTYryETc9a4mTw@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=avarab@gmail.com \
    --cc=bmburstein@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=rafaeloliveira.cs@gmail.com \
    --cc=rsbecker@nexbridge.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).