Thread (22 messages) flat view 22 messages, 5 authors, 2d ago

Re: [PATCH] worktree add: improve message for ambiguous remote branch name

From: Junio C Hamano <hidden>
Date: 2026-08-09 18:17:25

Junio C Hamano [off-list ref] writes:
Junio C Hamano [off-list ref] writes:
quoted
quoted
+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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help