Re: [PATCH v4 8/9] checkout: add advice for ambiguous "checkout <branch>"
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jun 1, 2018, 07:53 UTC
- Message-ID
- <CAPig+cQfw8-qJSt=Xbyxy1SUUDQZ-e1cGrG4g0KnO4zd7m+2dw@mail.gmail.com>
- In-Reply-To
- <20180531195252.29173-9-avarab@gmail.com>
On Thu, May 31, 2018 at 3:52 PM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 7 quoted lines
> 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 15 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/
Show 13 quoted lines
> 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>?"),