authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-31 16:41:24-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-31 16:41:24-07:00
log9afe5859a3e428b259a306c36a860e4d82dbb4bb
treed131d044630d2d3fb5d12c2f142ce749ec6a85e5
parentfbf269cc47a0a0bc0b60676ad97d4c57fda645c6

Revert "Remove 'g' prefix from commit hash in Zig semver"

This reverts commit 02438aabe3a04ac8ca2a2e0b2501ba18885652e3.

2 files changed, 3 insertions(+), 9 deletions(-)

CMakeLists.txt+1-1
......@@ -46,7 +46,7 @@ if("${ZIG_VERSION}" STREQUAL "")
4646 if(NOT GIT_TAG VERSION_EQUAL ZIG_VERSION)
4747 message(SEND_ERROR "Zig version (${ZIG_VERSION}) does not match Git tag (${GIT_TAG}).")
4848 endif()
49 elseif(GIT_DESCRIBE MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+)-g(.+)$")
49 elseif(GIT_DESCRIBE MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+)-(.+)$")
5050 # Untagged pre-release. The Zig version is updated to include the number of commits
5151 # since the last tagged version and the commit hash. The version is formatted in
5252 # accordance with the https://semver.org specification.
build.zig+2-8
......@@ -256,17 +256,11 @@ pub fn build(b: *Builder) !void {
256256 std.process.exit(1);
257257 }
258258
259 // Check that the commit hash is prefixed with a 'g' (a Git convention).
260 if (commit_id.len < 1 or commit_id[0] != 'g') {
261 std.debug.print("Unexpected `git describe` output: {}\n", .{git_describe});
262 break :v version_string;
263 }
264
265259 // The version is reformatted in accordance with the https://semver.org specification.
266 break :v b.fmt("{}-dev.{}+{}", .{ version_string, commit_height, commit_id[1..] });
260 break :v b.fmt("{}-dev.{}+{}", .{ version_string, commit_height, commit_id });
267261 },
268262 else => {
269 std.debug.print("Unexpected `git describe` output: {}\n", .{git_describe});
263 std.debug.print("Failed to parse `git describe` output: {}\n", .{git_describe});
270264 break :v version_string;
271265 },
272266 }