diff mbox series

[18/18] version-gen: generate proper interim versions

Message ID 20230414121841.373980-19-felipe.contreras@gmail.com (mailing list archive)
State Superseded
Headers show
Series [01/18] version-gen: reorganize | expand

Commit Message

Felipe Contreras April 14, 2023, 12:18 p.m. UTC
The change from dashes to dots was done in 2006 to satisfy some RPM
 requirements: 5c7d3c9507 (Allow building of RPM from interim snapshot.,
2006-01-16).

This probably was done because `2.40.0-100-g000` would be interpreted as
version `2.40.0` release `100`.

It isn't clear because the commit message doesn't explain.

But using a dot makes it worse because `2.40.0.n` will always be newer
than `2.40.0-n`.

What we want is an ordering such as:

 * 2.40.0         # git release
 * 2.40.0+100-g00 # interim version
 * 2.40.0-1       # Fedora release
 * 2.40.0.1       # hypothetical git release

So we should use a single `+` sign for interim versions, and for the
record that's what Mercurial does `6.3.3+hg591.dd42156b6441`.

[1] https://rpm-software-management.github.io/rpm/manual/dependencies.html

Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 GIT-VERSION-GEN | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 161fcdf1ab..99584bf86d 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -2,7 +2,7 @@ 
 
 get_version () {
 	test -f version && cat version && return
-	git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g' -e 's/^v//'
+	git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/+/' -e 's/^v//'
 }
 
 NEW="GIT_VERSION = $(get_version)"