[clang] [clang][python] Make .git_archival.txt deterministic. (PR #223362)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 14 04:18:52 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Adrian Kuegel (akuegel)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/223362.diff


1 Files Affected:

- (modified) clang/bindings/python/.git_archival.txt (+1-1) 


``````````diff
diff --git a/clang/bindings/python/.git_archival.txt b/clang/bindings/python/.git_archival.txt
index 7876d4af4c6206..2fdb3eb515902f 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)$

``````````

</details>


https://github.com/llvm/llvm-project/pull/223362


More information about the cfe-commits mailing list