Skip to content

Fix git describe abbrev length for reproducibility#815

Merged
bunnie merged 1 commit intobetrusted-io:mainfrom
sbellem:git-describe-abbrev
Feb 12, 2026
Merged

Fix git describe abbrev length for reproducibility#815
bunnie merged 1 commit intobetrusted-io:mainfrom
sbellem:git-describe-abbrev

Conversation

@sbellem
Copy link
Copy Markdown
Contributor

@sbellem sbellem commented Feb 12, 2026

git describe --long abbreviation length

This PR adds a GIT_ABBREV_LEN constant (set to 9) and uses --abbrev=9 to ensure consistent version strings regardless of clone depth.

The abbreviated hash length varies based on the number of objects in the local repository.

Git picks the shortest abbreviation that's unique among all objects it knows about:

  • Shallow clone → fewer objects → shorter hash (often 7 chars)
  • Full clone → more objects → longer hash may be needed (8, 9, 10+ chars)

Two builds of the same commit can produce different version strings:

Environment Output
Shallow CI clone v0.10.0-20-ga8eca71
Full local clone v0.10.0-20-ga8eca714d

Both are valid but different, breaking reproducibility.

Signed-off-by: Sylvain Bellemare <sbellem@gmail.com>
@sbellem sbellem force-pushed the git-describe-abbrev branch from 85e37de to 171e32e Compare February 12, 2026 10:31
@bunnie
Copy link
Copy Markdown
Member

bunnie commented Feb 12, 2026

good catch. thanks for fixing this!

@bunnie bunnie merged commit 3f9381f into betrusted-io:main Feb 12, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants