From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Dominik <dominik.seifert@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [Q] How to check git features for compatability?
Date: Mon, 01 Nov 2021 15:20:13 +0100 [thread overview]
Message-ID: <211101.865ytc3qaw.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <CACgoU8qhHunXwX=uG6AZrM=M3ofiM=AH37nVXAvN22Otwq=1eg@mail.gmail.com>
On Mon, Nov 01 2021, Dominik wrote:
> Hi,
>
> Scenario: I want to offer a simple utility that (among other things)
> automatically checks out git repositories. For that I want to use a
> specific feature (that is `git clone --branch`).
>
> Problem: Some user might have an old version of git where `git clone
> --branch` is not supported at all, or not supported in the same way.
>
> Q: How do I check which features which git version has? I fail to find
> the (rather commonly seen) `changelog.md` on the official git
> repository. Where should I look for a complete list? Is there a more
> complete documentation that lists the "earliest supported version" or
> some sort of "history of changes" for each of the git features, as is
> commonly seen in the API documentation of other CLI tools (e.g.
> https://nodejs.org/api/cli.html)?
>
>
> (PS: First time user here. Let me know if this is how you participate
> in this mailing list? I could not find any info on
> question-asking-etiquette either?)
In most cases, including this one, the best way to do this is to simply
run the command in question, and guard it with some wrapper that checks
for the 129 exit code. we'll emit that on usage errors:
$ git clone --unknown-future-flag 2>/dev/null; echo $?
129
If you're asking how you can find that without running a command like
that, the answer is that there really isn't a good way other than to
scour git.git's history. Even the release notes aren't always complete,
i.e. you'll find that there's options we've introduced that were never
explicitly mentioned in the release notes.
Even those that are are in human-readable prose, not anything machine
readable.
For "git clone --branch" specifically it seems to have been there since
2008 at least, so unless you're supporting some truly ancient
installations you shouldn't need to worry about it, but perhaps its
behavior changed in a way that I missed from a cursory look.
prev parent reply other threads:[~2021-11-01 14:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 14:11 [Q] How to check git features for compatability? Dominik
2021-11-01 14:20 ` Ævar Arnfjörð Bjarmason [this message]
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=211101.865ytc3qaw.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=dominik.seifert@gmail.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).