From 01ce0eb47244020cb6a00436aba45252fb824a99 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Fri, 3 Jan 2025 14:50:39 +0100 Subject: [PATCH] fix: make gen_version_info a little more robust closes #96 --- build.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.zig b/build.zig index 89e0069..c9b0a7e 100644 --- a/build.zig +++ b/build.zig @@ -482,9 +482,9 @@ fn gen_version_info( const describe = try b.runAllowFail(&[_][]const u8{ "git", "describe", "--always", "--tags" }, &code, .Ignore); const branch_ = try b.runAllowFail(&[_][]const u8{ "git", "rev-parse", "--abbrev-ref", "HEAD" }, &code, .Ignore); - const remote_ = try b.runAllowFail(&[_][]const u8{ "git", "config", "remote.origin.url" }, &code, .Ignore); - const log_ = try b.runAllowFail(&[_][]const u8{ "git", "log", "--pretty=oneline", "@{u}..." }, &code, .Ignore); - const diff_ = try b.runAllowFail(&[_][]const u8{ "git", "diff", "--stat", "--patch", "HEAD" }, &code, .Ignore); + const remote_ = b.runAllowFail(&[_][]const u8{ "git", "config", "remote.origin.url" }, &code, .Ignore) catch "(origin not found)"; + const log_ = b.runAllowFail(&[_][]const u8{ "git", "log", "--pretty=oneline", "@{u}..." }, &code, .Ignore) catch ""; + const diff_ = b.runAllowFail(&[_][]const u8{ "git", "diff", "--stat", "--patch", "HEAD" }, &code, .Ignore) catch "(git diff failed)"; const version = std.mem.trimRight(u8, describe, "\r\n "); const branch = std.mem.trimRight(u8, branch_, "\r\n "); const remote = std.mem.trimRight(u8, remote_, "\r\n ");