diff --git a/adbc_drivers_dev/make.py b/adbc_drivers_dev/make.py index 3c88019..73c5d03 100644 --- a/adbc_drivers_dev/make.py +++ b/adbc_drivers_dev/make.py @@ -229,7 +229,9 @@ def detect_version( ) ) rev = check_output(["git", "rev-parse", "--short", "HEAD"], cwd=repo_root) - version += f"-dev.{count}.{rev}" + # Prefix the revision so an all-numeric hash with a leading zero is + # not interpreted as an invalid numeric SemVer identifier. + version += f"-dev.{count}.g{rev}" # Append -dirty if there are uncommitted changes dirty = check_output(["git", "status", "--porcelain"], cwd=repo_root).splitlines() diff --git a/tests/test_detect_version.py b/tests/test_detect_version.py index 9611663..f4a3d17 100644 --- a/tests/test_detect_version.py +++ b/tests/test_detect_version.py @@ -80,7 +80,7 @@ def test_after_tag(repo): cwd=repo, ) version = detect_version(repo) - assert version.startswith("v1.2.3-dev.1."), version + assert version.startswith("v1.2.3-dev.1.g"), version def test_after_tag_subdir(repo):