pr-2197/yoichi/improve-worktree-add-error-message-v8
tagged this
25 Aug 21:04
'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. We also fix the behavior of --guess-remote when there are multiple matches. Changes from the previous patch: * add another commit to fix the behavior of --guess-remote Yoichi NAKAYAMA (4): checkout: extract function to display advice for ambiguous remotes checkout: improve message for ambiguous remote branch name worktree add: improve message for ambiguous remote branch name worktree add: treat multiple matches with --guess-remote as an error Documentation/config/worktree.adoc | 5 +- Documentation/git-worktree.adoc | 4 +- builtin/checkout.c | 76 ++++++++++++++++++------------ builtin/worktree.c | 57 +++++++++++++++++++--- checkout.c | 14 +++++- checkout.h | 5 +- t/t2400-worktree-add.sh | 17 ++++++- 7 files changed, 134 insertions(+), 44 deletions(-) base-commit: dea0ea3582e6980ddbc1173cc8e3e9f9db91cde0 Submitted-As: https://lore.kernel.org/git/pull.2197.v8.git.1787691875.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 In-Reply-To: https://lore.kernel.org/git/pull.2197.v5.git.1787143859.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.2197.v6.git.1787259838.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.2197.v7.git.1787368962.gitgitgadget@gmail.com