Merge pull request #620 from Techatrix/report-version

fallback when failing to run git describe
This commit is contained in:
Techatrix 2022-09-03 13:07:20 +00:00 committed by GitHub
commit a6ed5d1abf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,9 +48,10 @@ pub fn build(b: *std.build.Builder) !void {
const version = v: { const version = v: {
const version_string = b.fmt("{d}.{d}.{d}", .{ zls_version.major, zls_version.minor, zls_version.patch }); const version_string = b.fmt("{d}.{d}.{d}", .{ zls_version.major, zls_version.minor, zls_version.patch });
const git_describe_untrimmed = try b.exec(&[_][]const u8{ var code: u8 = undefined;
const git_describe_untrimmed = b.execAllowFail(&[_][]const u8{
"git", "-C", b.build_root, "describe", "--match", "*.*.*", "--tags", "git", "-C", b.build_root, "describe", "--match", "*.*.*", "--tags",
}); }, &code, .Ignore) catch break :v version_string;
const git_describe = std.mem.trim(u8, git_describe_untrimmed, " \n\r"); const git_describe = std.mem.trim(u8, git_describe_untrimmed, " \n\r");