commit 9afe5859a3e428b259a306c36a860e4d82dbb4bb (tree)
parent fbf269cc47a0a0bc0b60676ad97d4c57fda645c6
Author: Andrew Kelley <andrew@ziglang.org>
Date: Thu, 31 Dec 2020 16:41:24 -0700
Revert "Remove 'g' prefix from commit hash in Zig semver"
This reverts commit 02438aabe3a04ac8ca2a2e0b2501ba18885652e3.
Diffstat:
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -46,7 +46,7 @@ if("${ZIG_VERSION}" STREQUAL "")
if(NOT GIT_TAG VERSION_EQUAL ZIG_VERSION)
message(SEND_ERROR "Zig version (${ZIG_VERSION}) does not match Git tag (${GIT_TAG}).")
endif()
- elseif(GIT_DESCRIBE MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+)-g(.+)$")
+ elseif(GIT_DESCRIBE MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+)-(.+)$")
# Untagged pre-release. The Zig version is updated to include the number of commits
# since the last tagged version and the commit hash. The version is formatted in
# accordance with the https://semver.org specification.
diff --git a/build.zig b/build.zig
@@ -256,17 +256,11 @@ pub fn build(b: *Builder) !void {
std.process.exit(1);
}
- // Check that the commit hash is prefixed with a 'g' (a Git convention).
- if (commit_id.len < 1 or commit_id[0] != 'g') {
- std.debug.print("Unexpected `git describe` output: {}\n", .{git_describe});
- break :v version_string;
- }
-
// The version is reformatted in accordance with the https://semver.org specification.
- break :v b.fmt("{}-dev.{}+{}", .{ version_string, commit_height, commit_id[1..] });
+ break :v b.fmt("{}-dev.{}+{}", .{ version_string, commit_height, commit_id });
},
else => {
- std.debug.print("Unexpected `git describe` output: {}\n", .{git_describe});
+ std.debug.print("Failed to parse `git describe` output: {}\n", .{git_describe});
break :v version_string;
},
}