git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Baruch Burstein <bmburstein@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: misleading message printed when worktree add fails
Date: Sun, 28 Nov 2021 12:00:37 -0500	[thread overview]
Message-ID: <CAPig+cTGq-10ZTBts2LXRVdPMf2vNMX8HTuhg_+ZHSiLX-brOQ@mail.gmail.com> (raw)
In-Reply-To: <CA+34VNJbOHYhYgN+p7EsGiRAzf+aAQGeMxCzG1dizFjDRVQVbg@mail.gmail.com>

[please comment inline on this list rather than top-posting]

On Sun, Nov 28, 2021 at 11:47 AM Baruch Burstein <bmburstein@gmail.com> wrote:
> > When I perform these actions, I see a "fatal error" message which
> > clearly indicates failure, not success:
> >
> >     % git worktree add ../foo bar
> >     Preparing worktree (checking out 'bar')
> >     fatal: 'bar' is already checked out at '.../wherever'
>
> I see them in the other order:
>
>     fatal: 'master' is already checked out at 'C:/Users/bmbur/temp'
>     Preparing worktree (checking out 'master')
>
> which I understood as "there was an error, but we managed to recover
> somehow and set up the worktree anyway"

Okay, that's happening because the "Preparing" message is sent to
stdout, whereas the "fatal" error is sent to stderr, and the streams
are being flushed on Windows in a different order than what we
typically see on Unix platforms even though the "Preparing" message is
actually output first by the code.

A general fix (not specific to git-worktree) might be to have die()
(or maybe vreportf()?) flush stdout before reporting the error message
on stderr. That should make output order more predictable, such that
general status messages appear before error messages.

  reply	other threads:[~2021-11-28 17:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-28  6:50 misleading message printed when worktree add fails Baruch Burstein
2021-11-28 12:37 ` Eric Sunshine
2021-11-28 16:47   ` Baruch Burstein
2021-11-28 17:00     ` Eric Sunshine [this message]
2021-11-28 17:11       ` rsbecker
2021-11-30  4:46       ` Eric Sunshine

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+cTGq-10ZTBts2LXRVdPMf2vNMX8HTuhg_+ZHSiLX-brOQ@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=bmburstein@gmail.com \
    --cc=git@vger.kernel.org \
    /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).