All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: 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, 03 Dec 2021 10:17:02 +0100	[thread overview]
Message-ID: <211203.86fsrat592.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <20211203034420.47447-2-sunshine@sunshineco.com>


On Thu, Dec 02 2021, Eric Sunshine wrote:

> The order in which the stdout and stderr streams are flushed is not
> guaranteed to be the same across platforms or `libc` implementations.
> This lack of determinism can lead to anomalous and potentially confusing
> output if normal (stdout) output is flushed after error (stderr) output.
> For instance, the following output which clearly indicates a failure due
> to a fatal error:
>
>     % git worktree add ../foo bar
>     Preparing worktree (checking out 'bar')
>     fatal: 'bar' is already checked out at '.../wherever'
>
> has been reported[1] on Microsoft Windows to appear as:
>
>     % git worktree add ../foo bar
>     fatal: 'bar' is already checked out at '.../wherever'
>     Preparing worktree (checking out 'bar')

Makes sense.

>  test_expect_success 'repair incorrect gitdir' '
> @@ -141,10 +139,9 @@ test_expect_success 'repair incorrect gitdir' '
>  	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... :)

  reply	other threads:[~2021-12-03  9:19 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 [this message]
2021-12-03 13:07     ` Eric Sunshine
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

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

  git send-email \
    --in-reply-to=211203.86fsrat592.gmgdl@evledraar.gmail.com \
    --to=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 \
    --cc=sunshine@sunshineco.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.