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 "")...@@ -46,7 +46,7 @@ if("${ZIG_VERSION}" STREQUAL "")
46 if(NOT GIT_TAG VERSION_EQUAL ZIG_VERSION)46 if(NOT GIT_TAG VERSION_EQUAL ZIG_VERSION)
47 message(SEND_ERROR "Zig version (${ZIG_VERSION}) does not match Git tag (${GIT_TAG}).")47 message(SEND_ERROR "Zig version (${ZIG_VERSION}) does not match Git tag (${GIT_TAG}).")
48 endif()48 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]+)-(.+)$")
50 # Untagged pre-release. The Zig version is updated to include the number of commits50 # Untagged pre-release. The Zig version is updated to include the number of commits
51 # since the last tagged version and the commit hash. The version is formatted in51 # since the last tagged version and the commit hash. The version is formatted in
52 # accordance with the https://semver.org specification.52 # accordance with the https://semver.org specification.
build.zig+2-8
...@@ -256,17 +256,11 @@ pub fn build(b: *Builder) !void {...@@ -256,17 +256,11 @@ pub fn build(b: *Builder) !void {
256 std.process.exit(1);256 std.process.exit(1);
257 }257 }
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
265 // The version is reformatted in accordance with the https://semver.org specification.259 // 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 });
267 },261 },
268 else => {262 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});
270 break :v version_string;264 break :v version_string;
271 },265 },
272 }266 }