{"thread":{"id":"56823","subject":"[Q] How to check git features for compatability?","startedAt":"2021-11-01T14:11:35Z","lastAt":"2021-11-01T14:26:36Z","messageCount":2,"participants":["Dominik","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"440218","messageId":"CACgoU8qhHunXwX=uG6AZrM=M3ofiM=AH37nVXAvN22Otwq=1eg@mail.gmail.com","threadId":"56823","inReplyTo":null,"subject":"[Q] How to check git features for compatability?","fromName":"Dominik","fromEmail":"dominik.seifert@gmail.com","sentAt":"2021-11-01T14:11:17Z","receivedAt":"2021-11-01T14:11:35Z","isPatch":false,"sender":{"key":"dominik.seifert@gmail.com","avatar":null},"body":"Hi,\n\nScenario: I want to offer a simple utility that (among other things)\nautomatically checks out git repositories. For that I want to use a\nspecific feature (that is `git clone --branch`).\n\nProblem: Some user might have an old version of git where `git clone\n--branch` is not supported at all, or not supported in the same way.\n\nQ: How do I check which features which git version has? I fail to find\nthe (rather commonly seen) `changelog.md` on the official git\nrepository. Where should I look for a complete list? Is there a more\ncomplete documentation that lists the \"earliest supported version\" or\nsome sort of \"history of changes\" for each of the git features, as is\ncommonly seen in the API documentation of other CLI tools (e.g.\nhttps://nodejs.org/api/cli.html)?\n\n\n(PS: First time user here. Let me know if this is how you participate\nin this mailing list? I could not find any info on\nquestion-asking-etiquette either?)\n"},{"id":"440219","messageId":"211101.865ytc3qaw.gmgdl@evledraar.gmail.com","threadId":"56823","inReplyTo":"CACgoU8qhHunXwX=uG6AZrM=M3ofiM=AH37nVXAvN22Otwq=1eg@mail.gmail.com","subject":"Re: [Q] How to check git features for compatability?","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-11-01T14:20:13Z","receivedAt":"2021-11-01T14:26:36Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Mon, Nov 01 2021, Dominik wrote:\n\n> Hi,\n>\n> Scenario: I want to offer a simple utility that (among other things)\n> automatically checks out git repositories. For that I want to use a\n> specific feature (that is `git clone --branch`).\n>\n> Problem: Some user might have an old version of git where `git clone\n> --branch` is not supported at all, or not supported in the same way.\n>\n> Q: How do I check which features which git version has? I fail to find\n> the (rather commonly seen) `changelog.md` on the official git\n> repository. Where should I look for a complete list? Is there a more\n> complete documentation that lists the \"earliest supported version\" or\n> some sort of \"history of changes\" for each of the git features, as is\n> commonly seen in the API documentation of other CLI tools (e.g.\n> https://nodejs.org/api/cli.html)?\n>\n>\n> (PS: First time user here. Let me know if this is how you participate\n> in this mailing list? I could not find any info on\n> question-asking-etiquette either?)\n\nIn most cases, including this one, the best way to do this is to simply\nrun the command in question, and guard it with some wrapper that checks\nfor the 129 exit code. we'll emit that on usage errors:\n\n    $ git clone --unknown-future-flag 2>/dev/null; echo $?\n    129\n\nIf you're asking how you can find that without running a command like\nthat, the answer is that there really isn't a good way other than to\nscour git.git's history. Even the release notes aren't always complete,\ni.e. you'll find that there's options we've introduced that were never\nexplicitly mentioned in the release notes.\n\nEven those that are are in human-readable prose, not anything machine\nreadable.\n\nFor \"git clone --branch\" specifically it seems to have been there since\n2008 at least, so unless you're supporting some truly ancient\ninstallations you shouldn't need to worry about it, but perhaps its\nbehavior changed in a way that I missed from a cursory look.\n"}]}