Re: [PATCH] po: use `switch` over `checkout` in error message
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Nov 9, 2022, 21:40 UTC
- Message-ID
- <Y2weO5PczNYAJs/s@nand.local>
- In-Reply-To
- <pull.1308.git.git.1668018620148.gitgitgadget@gmail.com>
On Wed, Nov 09, 2022 at 06:30:17PM +0000, Max Coplan via GitGitGadget wrote:
Show 6 quoted lines
> From: =?UTF-8?q?Max=20=F0=9F=91=A8=F0=9F=8F=BD=E2=80=8D=F0=9F=92=BB=20Copl?= > =?UTF-8?q?an?= <mchcopl@gmail.com> > > Small change. Since `switch` is suggested for changing branches over > `checkout`, this commit updates an error message to use `switch` as the > default
OK.
> Signed-off-by: Max 👨🏽💻 Coplan <mchcopl@gmail.com>
Hmm ;-). It is generally preferred that you use your real name in the Signed-off-by trailer. I am guessing that your name does not have emoji in it.
See Documentation/SubmittingPatches for more.
> builtin/checkout.c | 2 +-
Show 16 quoted lines
> po/bg.po | 4 ++-- > po/ca.po | 4 ++-- > po/de.po | 4 ++-- > po/el.po | 4 ++-- > po/es.po | 4 ++-- > po/fr.po | 4 ++-- > po/id.po | 4 ++-- > po/it.po | 4 ++-- > po/pl.po | 4 ++-- > po/pt_PT.po | 2 +- > po/ru.po | 2 +- > po/sv.po | 4 ++-- > po/tr.po | 4 ++-- > po/vi.po | 4 ++-- > po/zh_CN.po | 4 ++-- > po/zh_TW.po | 4 ++--
Changes to po/ are coordinated by Jiang Xin, and the changes happen at:
https://github.com/git-l10n/git-po/
and are then pulled into this tree.
Show 13 quoted lines
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 29c74f898bf..51f9f928113 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -1222,7 +1222,7 @@ static const char *parse_remote_branch(const char *arg,
> advise(_("If you meant to check out a remote tracking branch on, e.g. 'origin',\n"
> "you can do so by fully qualifying the name with the --track option:\n"
> "\n"
> - " git checkout --track origin/<name>\n"
> + " git switch --track origin/<name>\n"
> "\n"
> "If you'd like to always have checkouts of an ambiguous <name> prefer\n"
> "one remote, e.g. the 'origin' remote, consider setting\n"Now we get to the main part of the change. And here I am torn:
- parse_remote_branch() is called from parse_branchname_arg() - parse_branchname_arg() has a single caller in checkout_main()
...which is called from 'cmd_switch()', 'cmd_restore()', and 'cmd_checkout()'.
So depending on which of those three we are being called from, the advice will or won't match up with the caller.
I haven't looked further to see if there is some mitigating condition that prevents us from ending up in parse_remote_branch() from callers outside of 'cmd_switch()', but I'm guessing that probably isn't the case.
So in that sense your patch isn't making anything worse, but I think empirically it does seem worse, since 'checkout' has more staying-power than 'switch' (at least at the time of writing).
We could set some static 'source' variable or some such to indicate which caller is driving us, but that feels a little hacky.
I dunno.
Thanks, Taylor