From: Junio C Hamano <gitster@pobox.com>
To: Yoichi Nakayama <yoichi.nakayama@gmail.com>
Cc: "D. Ben Knoble" <ben.knoble@gmail.com>,
Yoichi NAKAYAMA via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org, Harald Nordgren <haraldnordgren@gmail.com>
Subject: Re: [PATCH] worktree add: improve message for ambiguous remote branch name
Date: Mon, 10 Aug 2026 08:06:48 -0700 [thread overview]
Message-ID: <xmqqse4m6mlz.fsf@gitster.g> (raw)
In-Reply-To: <CAF5D8-vkd3GOOpdaC=swLv-gxtCzkdhNNUpbTSwr2PBH_Jk=1w@mail.gmail.com> (Yoichi Nakayama's message of "Mon, 10 Aug 2026 22:35:44 +0900")
Yoichi Nakayama <yoichi.nakayama@gmail.com> writes:
> Before the change, it calles lookup_commit_reference_by_name() again
> in the if condition and die() at:
>
> if (!opts.orphan && !lookup_commit_reference_by_name(branch)) {
> /* snip */
> die(_("invalid reference: %s"), branch);
> }
>
> The motivation for the fix was that this error message did not
> accurately reflect the situation.
The location of this die() is a tad away from the places that the
patch touched. The proposed log message could be made a bit more
helpful by mentioning it. What was posted reads:
Display a descriptive message when DWIM fails.
Add advice on how to work around this by specifying the fully
qualified name or by setting checkout.defaultRemote.
but telling the readers what they will see instead of a descriptive
message and how that happens would be very helpful to understand why
it is a good idea to die early. Perhaps
When the user runs 'git worktree add x y z' command that does
not exactly say which remote they want to work with, we try to
guess which remote by passing y. If there are multiple remotes
that have branch named y, we silently gave up, leaving remote
still NULL. This later causes A and B not happen, and we end up
with passing an non-existing branch to
lookup_commit_reference_by_name(), triggering "invalid
reference" error and die.
or something like that that describes the issue to a similar degree
as above mock-up message.
Thanks.
next prev parent reply other threads:[~2026-08-10 15:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 8:21 [PATCH] worktree add: improve message for ambiguous remote branch name Yoichi NAKAYAMA via GitGitGadget
2026-08-08 17:00 ` Junio C Hamano
2026-08-08 21:57 ` Junio C Hamano
2026-08-09 7:45 ` Harald Nordgren
2026-08-09 18:19 ` Junio C Hamano
2026-08-10 10:12 ` Harald Nordgren
2026-08-09 18:17 ` Junio C Hamano
2026-08-10 13:04 ` Yoichi Nakayama
2026-08-10 13:00 ` Yoichi Nakayama
2026-08-10 13:07 ` D. Ben Knoble
2026-08-10 13:35 ` Yoichi Nakayama
2026-08-10 15:06 ` Junio C Hamano [this message]
2026-08-10 21:36 ` Yoichi Nakayama
2026-08-10 15:07 ` [PATCH v2] " Yoichi NAKAYAMA via GitGitGadget
2026-08-10 20:55 ` [PATCH v3] " Yoichi NAKAYAMA via GitGitGadget
2026-08-11 0:03 ` Junio C Hamano
2026-08-11 6:31 ` Yoichi Nakayama
2026-08-11 6:35 ` [PATCH v4] " Yoichi NAKAYAMA via GitGitGadget
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=xmqqse4m6mlz.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=haraldnordgren@gmail.com \
--cc=yoichi.nakayama@gmail.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.