From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Francesco Occhipinti <Francesco.Occhipinti@tracsis.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: New checkout --track behaviour?
Date: Fri, 13 Dec 2024 03:48:56 +0000 [thread overview]
Message-ID: <Z1uuqKI_2rb0HXhP@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <DB9PR08MB71949D21F5F0E81911F0D50F903F2@DB9PR08MB7194.eurprd08.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 1580 bytes --]
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2024-12-13 3:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <DB9PR08MB7194822B81F17420B2D3C149903F2@DB9PR08MB7194.eurprd08.prod.outlook.com>
2024-12-12 10:29 ` New checkout --track behaviour? Francesco Occhipinti
2024-12-13 3:48 ` brian m. carlson [this message]
2024-12-13 10:39 ` Junio C Hamano
2024-12-13 10:50 ` Francesco Occhipinti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z1uuqKI_2rb0HXhP@tapette.crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=Francesco.Occhipinti@tracsis.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).