[clang] [clang][python] Make .git_archival.txt deterministic. (PR #223362)
Adrian Kuegel via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 14 04:18:15 PDT 2026
https://github.com/akuegel created https://github.com/llvm/llvm-project/pull/223362
Without an explicit `abbrev` option, `$Format:%(describe:...)` uses Git's dynamic object abbreviation length (`find_unique_abbrev`). In a large, rapidly growing repository like `llvm-project`, new commits can potentially collide with existing short-SHA prefixes, causing GitHub's `git archive` servers to emit longer short-SHAs over time for historical commits. This mutates `clang/bindings/python/.git_archival.txt` inside GitHub's dynamically generated `.tar.gz`/`.zip` source archives, breaking downstream builds (such as OpenXLA/Bazel) that verify archive SHA-256 checksums.
Specify `abbrev=40` so `describe-name` always uses the full 40-character commit hash. `hatch-vcs` slices the parsed node ID to 10 characters when formatting versions, so the resulting Python package version is unchanged.
>From 08228c23ac4dfa5707dffd20b650bd42bf5418c0 Mon Sep 17 00:00:00 2001
From: Adrian Kuegel <akuegel at google.com>
Date: Mon, 14 Sep 2026 11:11:27 +0000
Subject: [PATCH] [clang][python] Make .git_archival.txt deterministic.
Without an explicit `abbrev` option, `$Format:%(describe:...)` uses Git's
dynamic object abbreviation length (`find_unique_abbrev`). In a large,
rapidly growing repository like `llvm-project`, new commits can potentially
collide with existing short-SHA prefixes, causing GitHub's `git archive` servers
to emit longer short-SHAs over time for historical commits.
This mutates `clang/bindings/python/.git_archival.txt` inside GitHub's
dynamically generated `.tar.gz`/`.zip` source archives, breaking
downstream builds (such as OpenXLA/Bazel) that verify archive SHA-256
checksums.
Specify `abbrev=40` so `describe-name` always uses the full 40-character
commit hash. `hatch-vcs` slices the parsed node ID to 10 characters
when formatting versions, so the resulting Python package version is
unchanged.
---
clang/bindings/python/.git_archival.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/bindings/python/.git_archival.txt b/clang/bindings/python/.git_archival.txt
index 7876d4af4c620..2fdb3eb515902 100644
--- a/clang/bindings/python/.git_archival.txt
+++ b/clang/bindings/python/.git_archival.txt
@@ -1,3 +1,3 @@
node: $Format:%H$
node-date: $Format:%cI$
-describe-name: $Format:%(describe:tags=true,match=llvmorg-*[0-9]*)$
+describe-name: $Format:%(describe:tags=true,match=llvmorg-*[0-9]*,abbrev=40)$
More information about the cfe-commits
mailing list