Re: New checkout --track behaviour?

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

 



On 2024-12-12 at 10:29:59, Francesco Occhipinti wrote:
> Hello,
> 
> Did the interface change in recent git versions? I am pretty sure i
> used to git checkout -tb new_branch, now getting error: option
> `--track' expects "direct" or "inherit".
> 
> User `geirha` on libera#git helped me troubleshooting. They noticed that:
> 
> - git help checkout differs in its description of --track between
>   2.34.1 (ubuntu 22.04) and 2.43.0 (ubuntu 24.04), so looks like it
>   did change recently
> 
> - according to the commit message at
>   https://github.com/git/git/commit/6327f0efed36c64d98a140110171362b7cb75a52,
>   -t is supposed to be equivalent to --track=direct, so likely a bug
>   rather than intentional change

`-t`, or `--track`, now takes an optional argument.  Before, it didn't,
so `-tb` was interpreted as `--track -b`.  Now, it's interpreted as
`--track=b`, since the `b` is interpreted as the option value to
`--track`.  That's not a valid value, so you get the error message.

This is indeed a subtle incompatibility in command-line option parsing,
but it's not really avoidable and it does occur in pretty much any case
where a short option learns to take an optional argument (for any
software, not just Git).  So what you probably want to do is `git
checkout -t -b new_branch`, and it will work as before.  That will also
work on older versions as well, so if you have scripts or aliases that
need to work across versions, that should be a safe syntax to use.
-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA

Attachment: signature.asc
Description: PGP signature


[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