pr-2197/yoichi/improve-worktree-add-error-message-v10
tagged this
27 Aug 14:41
'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: * [1/4] fix the function name and add detailed commit message * [2/4] change type of tracking_name_data.remote_names 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 | 13 ++++- checkout.h | 5 +- t/t2400-worktree-add.sh | 17 ++++++- 7 files changed, 133 insertions(+), 44 deletions(-) base-commit: f78ce2f7b6df702f93d40b85d6bda92a3f65da79 Submitted-As: https://lore.kernel.org/git/pull.2197.v10.git.1787841717.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 In-Reply-To: https://lore.kernel.org/git/pull.2197.v8.git.1787691875.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.2197.v9.git.1787741111.gitgitgadget@gmail.com