Skip to content

🐛 fix(revision): warn only when the commit is lost - #10

Merged
gaborbernat merged 1 commit into
mainfrom
warn-unrecovered-revision
Nov 10, 2026
Merged

gaborbernat merged 1 commit into
mainfrom
warn-unrecovered-revision

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

Every uv build of a project that uses python-sbom printed UserWarning: git cannot read the source revision ... fatal: invalid gitfile format while building the wheel, although the wheel still recorded the exact commit. uv builds the wheel from the unpacked sdist under its cache, where it keeps an empty .git file so tools do not treat the cache as part of a repository. git rejects that file, python-sbom warned, then read the commit from the sdist's .python-sbom-revision anyway. 🔇

Now a git failure only warns when no later source names the commit either, so the build that loses its source revision still says why, with git's error, and the build that recovers it stays quiet. The order of the sources does not change: git first, then the sdist's record, then .git_archival.txt.

I built the hatchling docs example with uv build against this branch: no warning, and the wheel's SBOM links the commit the sdist recorded.

@gaborbernat gaborbernat added the bug Something isn't working label Nov 10, 2026
@gaborbernat
gaborbernat marked this pull request as ready for review November 10, 2026 00:28
@gaborbernat
gaborbernat merged commit da069a3 into main Nov 10, 2026
38 checks passed
@gaborbernat
gaborbernat deleted the warn-unrecovered-revision branch November 10, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant