Re: [PATCH v4 8/9] checkout: add advice for ambiguous "checkout <branch>"
On Fri, Jun 01 2018, Eric Sunshine wrote:
Show 12 quoted lines
> On Thu, May 31, 2018 at 3:52 PM, Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>> As the "checkout" documentation describes:
>>
>> If <branch> is not found but there does exist a tracking branch in
>> exactly one remote (call it <remote>) with a matching name, treat
>> as equivalent to [...] <remote>/<branch.
>>
>> This is a really useful feature, the problem is that when you another
>
> s/, the/. The/
> s/you/& add/
Show 35 quoted lines
>> remote (e.g. a fork) git won't find a unique branch name anymore, and
>> will instead print this nondescript message:
>>
>> $ git checkout master
>> error: pathspec 'master' did not match any file(s) known to git
>>
>> Now it will, on my git.git checkout, print:
>>
>> $ ./git --exec-path=$PWD checkout master
>> error: pathspec 'master' did not match any file(s) known to git.
>> hint: The argument 'master' matched more than one remote tracking branch.
>> hint: We found 26 remotes with a reference that matched. So we fell back
>> hint: on trying to resolve the argument as a path, but failed there too!
>> hint:
>> hint: Perhaps you meant fully qualify the branch name? E.g. origin/<name>
>
> s/meant/& to/
>
>> hint: instead of <name>?
>>
>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>> ---
>> diff --git a/builtin/checkout.c b/builtin/checkout.c
>> @@ -1269,6 +1270,16 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
>> + if (ret && dwim_remotes_matched > 1 &&
>> + advice_checkout_ambiguous_remote_branch_name)
>> + advise(_("The argument '%s' matched more than one remote tracking branch.\n"
>> + "We found %d remotes with a reference that matched. So we fell back\n"
>> + "on trying to resolve the argument as a path, but failed there too!\n"
>> + "\n"
>> + "Perhaps you meant fully qualify the branch name? E.g. origin/<name>\n"
>
> s/meant/& to/
>
>> + "instead of <name>?"),Will rephrase to make this less confusing.