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

Re: misleading message printed when worktree add fails

From
BBBaruch Burstein <bmburstein@gmail.com>
Date
Nov 28, 2021, 16:47 UTC
Message-ID
<CA+34VNJbOHYhYgN+p7EsGiRAzf+aAQGeMxCzG1dizFjDRVQVbg@mail.gmail.com>
In-Reply-To
<CAPig+cQ224Tz5iQ5Yt4fMadehLmrJWGzH7kwUSr+UT4hcQf14w@mail.gmail.com>
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"

On Sun, Nov 28, 2021 at 2:37 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 37 quoted lines
>
> Thanks for reporting. Inline comments below...
>
> On Sun, Nov 28, 2021 at 1:53 AM Baruch Burstein <bmburstein@gmail.com> wrote:
> > What did you do before the bug happened? (Steps to reproduce your issue)
> >
> > run `git worktree add <path> <branch>`, where <branch> is an already
> > checked-out branch
> >
> > What happened instead? (Actual behavior)
> >
> > worktree was not created, but a confusing message was printed:
> > "Preparing worktree (checking out '<branch>')"
> >
> > What's different between what you expected and what actually happened?
> >
> > The printed message seems to indicate that the command was a success,
> > when in fact
> > it was not
>
> 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'
>
> Is your installation not showing the "fatal error" message?
>
> Or, are you saying that the "Preparing worktree" message is
> misleading? I read that message as telling me what the command is
> trying to do (i.e. "Preparing"), and the error happens as it makes the
> attempts, which seems logical to me, thus I don't see anything
> misleading in that.
>
> Are you reading it differently, as if it is saying that it already
> performed that action (i.e. "Prepared")?
Previous: Eric SunshineNext: Eric Sunshine
Message 3 of 6 in “misleading message printed when worktree add fails”
  1. Baruch BursteinNov 28, 2021
  2. Eric SunshineNov 28, 2021
  3. Baruch BursteinNov 28, 2021
  4. Eric SunshineNov 28, 2021
  5. rsbecker@nexbridge.comNov 28, 2021
  6. Eric SunshineNov 30, 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.