| ... | ... | @@ -234,18 +234,6 @@ pub fn build(b: *Builder) !void { |
| 234 | 234 | break :v version_string; |
| 235 | 235 | }; |
| 236 | 236 | const git_sha_trimmed = mem.trim(u8, git_sha_untrimmed, " \n\r"); |
| 237 | | // Detect dirty changes. |
| 238 | | const diff_untrimmed = b.execAllowFail(&[_][]const u8{ |
| 239 | | "git", "-C", b.build_root, "diff", "HEAD", |
| 240 | | }, &code, .Ignore) catch |err| { |
| 241 | | std.debug.print("Error executing git diff: {}", .{err}); |
| 242 | | std.process.exit(1); |
| 243 | | }; |
| 244 | | const trimmed_diff = mem.trim(u8, diff_untrimmed, " \n\r"); |
| 245 | | const dirty_suffix = if (trimmed_diff.len == 0) "" else s: { |
| 246 | | const dirty_hash = std.hash.Wyhash.hash(0, trimmed_diff); |
| 247 | | break :s b.fmt("dirty{x}", .{@truncate(u32, dirty_hash)}); |
| 248 | | }; |
| 249 | 237 | |
| 250 | 238 | // This will look like e.g. "0.7.0^0" for a tag commit. |
| 251 | 239 | if (mem.endsWith(u8, git_sha_trimmed, "^0")) { |
| ... | ... | @@ -254,9 +242,9 @@ pub fn build(b: *Builder) !void { |
| 254 | 242 | std.debug.print("Expected git tag '{}', found '{}'\n", .{ version_string, git_ver_string }); |
| 255 | 243 | std.process.exit(1); |
| 256 | 244 | } |
| 257 | | break :v b.fmt("{}{}", .{ version_string, dirty_suffix }); |
| 245 | break :v b.fmt("{}", .{version_string}); |
| 258 | 246 | } else { |
| 259 | | break :v b.fmt("{}+{}{}", .{ version_string, git_sha_trimmed, dirty_suffix }); |
| 247 | break :v b.fmt("{}+{}", .{ version_string, git_sha_trimmed }); |
| 260 | 248 | } |
| 261 | 249 | }; |
| 262 | 250 | exe.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); |