{"thread":{"id":"64094","subject":"[PATCH] GIT-VERSION-GEN: Use standard versioning suffix","startedAt":"2025-09-05T12:14:48Z","lastAt":"2025-09-05T15:19:04Z","messageCount":5,"participants":["Jonas Rebmann","brian m. carlson","Kristoffer Haugsbakk","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"525618","messageId":"20250905-semver-v1-1-3f6dd32f71a3@pengutronix.de","threadId":"64094","inReplyTo":null,"subject":"[PATCH] GIT-VERSION-GEN: Use standard versioning suffix","fromName":"Jonas Rebmann","fromEmail":"jre@pengutronix.de","sentAt":"2025-09-05T12:14:38Z","receivedAt":"2025-09-05T12:14:48Z","isPatch":true,"sender":{"key":"jre@pengutronix.de","avatar":null},"body":"In snapshot builds of git, git-version uses a modified variant of the\ngit-describe output, e.g. 2.51.0.178.g2462961280 instead of\n2.51.0-178-g2462961280 for seemingly historical reasons.\n\nThis is not semver compliant which makes the output harder to parse in\ntooling such as b4, which currently errors out when using a snapshot\nbuild of git.\n\nFor snapshot builds, use as version string the unmodified git-describe\noutput with only the leading v stripped from the tag.\n\nFixes: 5c7d3c9507f7 (\"Allow building of RPM from interim snapshot.\")\nSigned-off-by: Jonas Rebmann <jre@pengutronix.de>\n---\n GIT-VERSION-GEN | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex b16db85e77..99e04588f3 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -52,7 +52,7 @@ then\n \t\t*$LF*) (exit 1) ;;\n \t\tesac\n \tthen\n-\t\tVN=$(echo \"$VN\" | sed -e 's/-/./g');\n+\t\t: # use VN as set by git describe\n \telse\n \t\tVN=\"$DEF_VER\"\n \tfi\n\n---\nbase-commit: 2462961280690837670d997bde64bd4ebf8ae66d\nchange-id: 20250905-semver-2e9a9a9c77ef\n\nBest regards,\n--  \nJonas Rebmann <jre@pengutronix.de>\n\n"},{"id":"525619","messageId":"aLrVQLZpAf-WqFvY@fruit.crustytoothpaste.net","threadId":"64094","inReplyTo":"20250905-semver-v1-1-3f6dd32f71a3@pengutronix.de","subject":"Re: [PATCH] GIT-VERSION-GEN: Use standard versioning suffix","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2025-09-05T12:19:12Z","receivedAt":"2025-09-05T12:19:20Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2025-09-05 at 12:14:38, Jonas Rebmann wrote:\n> In snapshot builds of git, git-version uses a modified variant of the\n> git-describe output, e.g. 2.51.0.178.g2462961280 instead of\n> 2.51.0-178-g2462961280 for seemingly historical reasons.\n> \n> This is not semver compliant which makes the output harder to parse in\n> tooling such as b4, which currently errors out when using a snapshot\n> build of git.\n\nGit doesn't follow SemVer.  We make breaking and incompatible changes\nwithout bumping the major version all the time, so it doesn't make sense\nto say that we should follow SemVer for version numbers.\n\nI would say that since Git has had this version number format for a long\ntime, b4, which is much newer and should be designed to work with Git,\nshould gracefully handle the Git version number rather than have Git\nconform to b4.\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\n"},{"id":"525621","messageId":"8e8255bf-79d0-41ee-85a9-d664ee01b5ae@app.fastmail.com","threadId":"64094","inReplyTo":"20250905-semver-v1-1-3f6dd32f71a3@pengutronix.de","subject":"Re: [PATCH] GIT-VERSION-GEN: Use standard versioning suffix","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2025-09-05T12:32:52Z","receivedAt":"2025-09-05T12:33:14Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"Hi\n\nThe following might not be immediately relevant in light of what brian\njust wrote.\n\nOn Fri, Sep 5, 2025, at 14:14, Jonas Rebmann wrote:\n>[snip]\n> This is not semver compliant which makes the output harder to parse in\n> tooling such as b4, which currently errors out when using a snapshot\n> build of git.\n>\n> For snapshot builds, use as version string the unmodified git-describe\n> output with only the leading v stripped from the tag.\n>\n> Fixes: 5c7d3c9507f7 (\"Allow building of RPM from interim snapshot.\")\n\nFor other readers: this can be traced back to from\n\n• `git log -S'VN=$(echo \"$VN\"' GIT-VERSION-GEN`\n• which finds 374dfaa2e39 (Make GIT-VERSION-GEN tolerate missing git\n  describe command again, 2006-01-26)\n• which in turn references this 5c7d3c9507f (Allow building of RPM from\n  interim snapshot., 2006-01-16)\n\nThis project doesn’t use this Kernel-style trailer.[1]  Also not the commit\nreference style. (It uses `git show -s --pretty=reference <commit>`)\n\nIt’s more common to place it inside the body of the message.  Like a\nreplacement for the preceding “historical reasons”.\n\n† 1: It’s almost only trailers which attribute people. (I am having a hard\n    time coming up with exceptions; you can find at least \n    one Cherry-picked-from)\n\n> Signed-off-by: Jonas Rebmann <jre@pengutronix.de>\n"},{"id":"525634","messageId":"9928e25d-f20c-41c1-9a33-5214f54fb11c@pengutronix.de","threadId":"64094","inReplyTo":"aLrVQLZpAf-WqFvY@fruit.crustytoothpaste.net","subject":"Re: [PATCH] GIT-VERSION-GEN: Use standard versioning suffix","fromName":"Jonas Rebmann","fromEmail":"jre@pengutronix.de","sentAt":"2025-09-05T13:43:21Z","receivedAt":"2025-09-05T13:43:23Z","isPatch":true,"sender":{"key":"jre@pengutronix.de","avatar":null},"body":"On 2025-09-05 14:19, brian m. carlson wrote:\n> Git doesn't follow SemVer.  We make breaking and incompatible changes\n> without bumping the major version all the time, so it doesn't make sense\n> to say that we should follow SemVer for version numbers.\n\nI meant the lexical format of semver, rather than its semantics, and the\nway that snapshot-version suffixes are separated in particular. The\noutput of git-describe already aligns with the semver syntax so it seems\nreasonable to expect that `git version` of a snapshot build would follow\nthe same syntax, which has become quite common, and for which parsers\nare ubiquitous.\n\nThe change in 2006 (commit 5c7d3c9507f7) aimed to make versions\nmonotonic for RPM packaging but the resulting format doesn't seem to\nconform to a known version string format, and not to today's\nRPM-packaging guidelines either looking at [1].\n\n> I would say that since Git has had this version number format for a long\n> time, b4, which is much newer and should be designed to work with Git,\n> should gracefully handle the Git version number rather than have Git\n> conform to b4.\n\nIs this really Git's version format, or just how git-version happens to\nprint in snapshot builds? Is this format used or depended on anywhere\nelse?\n\nI agree that b4 must follow what git-version outputs and I sent a patch\nfor b4 [2] but each tool having to implement custom parsing for only the\nspecifics of the git-version output (as opposed to git-describe which\nfollows a common format) makes integration needlessly difficult.\n\nRegards, Jonas\n\n[1]: https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/\n[2]: https://lore.kernel.org/tools/20250905-versionparse-v1-1-48d926da9c10@pengutronix.de\n"},{"id":"525646","messageId":"xmqqh5xh3p23.fsf@gitster.g","threadId":"64094","inReplyTo":"aLrVQLZpAf-WqFvY@fruit.crustytoothpaste.net","subject":"Re: [PATCH] GIT-VERSION-GEN: Use standard versioning suffix","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-09-05T15:19:00Z","receivedAt":"2025-09-05T15:19:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> On 2025-09-05 at 12:14:38, Jonas Rebmann wrote:\n>> In snapshot builds of git, git-version uses a modified variant of the\n>> git-describe output, e.g. 2.51.0.178.g2462961280 instead of\n>> 2.51.0-178-g2462961280 for seemingly historical reasons.\n>> \n>> This is not semver compliant which makes the output harder to parse in\n>> tooling such as b4, which currently errors out when using a snapshot\n>> build of git.\n>\n> Git doesn't follow SemVer.  We make breaking and incompatible changes\n> without bumping the major version all the time, so it doesn't make sense\n> to say that we should follow SemVer for version numbers.\n>\n> I would say that since Git has had this version number format for a long\n> time, b4, which is much newer and should be designed to work with Git,\n> should gracefully handle the Git version number rather than have Git\n> conform to b4.\n\nWell said.\n\nIf somebody cares about the format deeply enough to patch it, it is\nlikely that somebody else cares equally deeply about the current\nformat and depends on it, as Git these days are used by more than a\nfew thousands of people, and \"semvar syntax\" is too weak a reason to\nchange it for everybody.\n\nIf somebody wants to have their own versioning scheme, there is an\nescape hatch to drop the \"version\" file in their source material,\nwhich does not have to change versioning schemes used by other\nbuilders with a patch like this one.\n\nThanks.\n"}]}