neurocyte/flow
4
149
Fork
You've already forked flow
5

Implement fallback for gen_version() #25

Closed
bwbuhse wants to merge 1 commit from bwbuhse/version-fallback into master AGit
pull from: bwbuhse/version-fallback
merge into: neurocyte:master
neurocyte:master
neurocyte:terminal
neurocyte:v0.7
neurocyte:zig-0.13
First-time contributor
Copy link

Building from a release tarball (without a .git directory) currently panics in release mode because gen_version and gen_version_info use try on git commands that fail. This changes the git calls to catch and falls back to manifest.version from build.zig.zon when git describe returns nothing. The committed: field is omitted when git history isn't available, and git-dependent fields (branch, diff, log) gracefully degrade to empty. This allows distro packagers to build from the release tarball without needing to fake a git repository.

Building from a release tarball (without a .git directory) currently panics in release mode because gen_version and gen_version_info use try on git commands that fail. This changes the git calls to catch and falls back to manifest.version from build.zig.zon when git describe returns nothing. The committed: field is omitted when git history isn't available, and git-dependent fields (branch, diff, log) gracefully degrade to empty. This allows distro packagers to build from the release tarball without needing to fake a git repository.
Author
First-time contributor
Copy link

I didn't see the latest release was actually implementing the panic, so feel free to close this if I'm misunderstanding. My main thing was that I was trying to make an ebuild for Gentoo but because it just downloads the source tarball instead of cloning, it panics.

I didn't see the latest release was actually *implementing* the panic, so feel free to close this if I'm misunderstanding. My main thing was that I was trying to make an ebuild for Gentoo but because it just downloads the source tarball instead of cloning, it panics.

The build error is intentional to help prevent producing release builds with partial version information. I don't think side stepping that is an improvement and it is not actually needed because you can just build without the --release flag, which is probably what you want for Gentoo. It might make sense to pre-generate the full version file for building from tarballs with no .git directory (although I personally don't see the point), but that is not what this change does anyway so I'm just going to close.

The build error is intentional to help prevent producing release builds with partial version information. I don't think side stepping that is an improvement and it is not actually needed because you can just build without the `--release` flag, which is probably what you want for Gentoo. It might make sense to pre-generate the full version file for building from tarballs with no `.git` directory (although I personally don't see the point), but that is not what this change does anyway so I'm just going to close.
neurocyte closed this pull request 2026年04月13日 19:40:55 +02:00

Hope you don't mind. Thanks anyway!

Hope you don't mind. Thanks anyway!

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
neurocyte/flow!25
Reference in a new issue
neurocyte/flow
No description provided.
Delete branch "bwbuhse/version-fallback"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?