Re: [PATCH] po: use `switch` over `checkout` in error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 09, 2022 at 06:30:17PM +0000, Max Coplan via GitGitGadget wrote:
> 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@xxxxxxxxx>
>
> 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@xxxxxxxxx>

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 +-

>  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.

> 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux