Re: [PATCH] worktree add: improve message for ambiguous remote branch name
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 9, 2026, 18:17 UTC
- Message-ID
- <xmqqjypz9n0s.fsf@gitster.g>
- In-Reply-To
- <xmqqo6fc9swz.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 15 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>>> +static const char message_advice_ambiguous_remote_tracking_branch[] =
>>> + N_("If you meant to create a worktree from a remote tracking branch on,\n"
>>> + "e.g. 'origin', you can do so by fully qualifying the name:\n"
>>> + "\n"
>>> + " git worktree add <path> origin/<name>\n"
>>> + "\n"
>>> ...
>>> + char *remote = unique_tracking_name(*new_branch, &oid, &num_matches);
>>> + if (!opts->quiet && !remote && num_matches > 1) {
>>> + if (advice_enabled(ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME))
>>> + advise(_(message_advice_ambiguous_remote_tracking_branch));
>>> + warning(_("'%s' matched multiple (%d) remote tracking branches\n"), branchname, num_matches);
>>> + }Sorry for piecemeal reviews, but I just noticed that you have a terminating LF at the end of a single-liner warning message. As die/error/warning ffamily of helpers give the terminating newline themselves, you must not. Unless you want to leave a blank line after your message, that is.
Thanks.