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.
Implement fallback for gen_version() #25
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.
Hope you don't mind. Thanks anyway!
Pull request closed
No due date set.
No dependencies set.
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?