git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] worktree: send "chatty" messages to stderr

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 3, 2021, 09:17 UTC
Message-ID
<211203.86fsrat592.gmgdl@evledraar.gmail.com>
In-Reply-To
<20211203034420.47447-2-sunshine@sunshineco.com>
On Thu, Dec 02 2021, Eric Sunshine wrote:
Show 16 quoted lines
> 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.
Show 12 quoted lines
>  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... :)
Previous: Eric SunshineNext: Eric Sunshine
Message 3 of 14 in “worktree: fix incorrectly-ordered messages on Windows”
  1. 0/2 worktree: fix incorrectly-ordered messages on WindowsEric Sunshine, Dec 3, 2021
  2. 1/2 worktree: send "chatty" messages to stderrEric Sunshine, Dec 3, 2021
  3. Ævar Arnfjörð BjarmasonDec 3, 2021
  4. Eric SunshineDec 3, 2021
  5. 2/2 git-worktree.txt: add missing `-v` to synopsis for `worktree list`Eric Sunshine, Dec 3, 2021
  6. Ævar Arnfjörð BjarmasonDec 3, 2021
  7. Eric SunshineDec 3, 2021
  8. Ævar Arnfjörð BjarmasonDec 3, 2021
  9. Jeff KingDec 3, 2021
  10. Junio C HamanoDec 5, 2021
  11. Eric SunshineDec 6, 2021
  12. Ævar Arnfjörð BjarmasonDec 6, 2021
  13. Junio C HamanoDec 6, 2021
  14. Rafael SilvaDec 11, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.