pr-2197/yoichi/improve-worktree-add-error-message-v5
tagged this
19 Aug 12:50
'git worktree add ../foo-dir bar-topic' fails to dwim when there are multiple remote branches with name `bar-topic'. But it doesn't display meaningful message as 'git checkout bar-topic' does under the same situation. We improve this by adding advice and modify the error message for worktree add. By Junio's suggestion, we include matched remote names in the advice. It is applied to checkout, too. The changes to 'checkout' are almost identical to what Junio proposed; I have made minor adjustments to use the specified branch name. I'm not sure how to handle the "Author" field in this case, so I've set it to myself for now, but I'll correct it if that's not appropriate. Yoichi NAKAYAMA (2): checkout: improve message for ambiguous remote branch name worktree add: improve message for ambiguous remote branch name builtin/checkout.c | 75 ++++++++++++++++++++++++----------------- builtin/worktree.c | 36 ++++++++++++++++++-- checkout.c | 14 ++++++-- checkout.h | 5 ++- t/t2400-worktree-add.sh | 4 +-- 5 files changed, 96 insertions(+), 38 deletions(-) base-commit: dea0ea3582e6980ddbc1173cc8e3e9f9db91cde0 Submitted-As: https://lore.kernel.org/git/pull.2197.v5.git.1787143859.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.2197.git.1786177301832.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.2197.v2.git.1786374470383.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.2197.v3.git.1786395305884.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.2197.v4.git.1786430155244.gitgitgadget@gmail.com