authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-18 14:43:07-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-19 00:54:48-08:00
logf545fc28b35b454b2b0167ede45aeacc0cd93387
tree4c71ae6e0cc5ffa16c2eb14a9f8c166524c2bf06
parent90a19f74116eb09e4711d845d08c011cb62b8cbf

build: pass --abbrev to git rather than relying on global config

For computing the zig version number, pass --abbrev=9 rather than requiring the user to set their git configuration in order to make zig versions match the standard.

12 files changed, 9 insertions(+), 12 deletions(-)

CMakeLists.txt+1-1
...@@ -45,7 +45,7 @@ if("${ZIG_VERSION}" STREQUAL "")...@@ -45,7 +45,7 @@ if("${ZIG_VERSION}" STREQUAL "")
45 find_program(GIT_EXE NAMES git NAMES_PER_DIR)45 find_program(GIT_EXE NAMES git NAMES_PER_DIR)
46 if(GIT_EXE)46 if(GIT_EXE)
47 execute_process(47 execute_process(
48 COMMAND ${GIT_EXE} -C ${CMAKE_SOURCE_DIR} describe --match *.*.* --tags48 COMMAND ${GIT_EXE} -C ${CMAKE_SOURCE_DIR} describe --match *.*.* --tags --abbrev=9
49 RESULT_VARIABLE EXIT_STATUS49 RESULT_VARIABLE EXIT_STATUS
50 OUTPUT_VARIABLE GIT_DESCRIBE50 OUTPUT_VARIABLE GIT_DESCRIBE
51 OUTPUT_STRIP_TRAILING_WHITESPACE51 OUTPUT_STRIP_TRAILING_WHITESPACE
build.zig+8-1
...@@ -263,7 +263,14 @@ pub fn build(b: *std.Build) !void {...@@ -263,7 +263,14 @@ pub fn build(b: *std.Build) !void {
263263
264 var code: u8 = undefined;264 var code: u8 = undefined;
265 const git_describe_untrimmed = b.runAllowFail(&[_][]const u8{265 const git_describe_untrimmed = b.runAllowFail(&[_][]const u8{
266 "git", "-C", b.build_root.path orelse ".", "describe", "--match", "*.*.*", "--tags",266 "git",
267 "-C",
268 b.build_root.path orelse ".",
269 "describe",
270 "--match",
271 "*.*.*",
272 "--tags",
273 "--abbrev=9",
267 }, &code, .Ignore) catch {274 }, &code, .Ignore) catch {
268 break :v version_string;275 break :v version_string;
269 };276 };
ci/aarch64-linux-debug.sh-1
...@@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH"...@@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH"
1616
17# Make the `zig version` number consistent.17# Make the `zig version` number consistent.
18# This will affect the cmake command below.18# This will affect the cmake command below.
19git config core.abbrev 9
20git fetch --unshallow || true19git fetch --unshallow || true
21git fetch --tags20git fetch --tags
2221
ci/aarch64-linux-release.sh-1
...@@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH"...@@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH"
1616
17# Make the `zig version` number consistent.17# Make the `zig version` number consistent.
18# This will affect the cmake command below.18# This will affect the cmake command below.
19git config core.abbrev 9
20git fetch --unshallow || true19git fetch --unshallow || true
21git fetch --tags20git fetch --tags
2221
ci/aarch64-macos-debug.sh-1
...@@ -17,7 +17,6 @@ cd $ZIGDIR...@@ -17,7 +17,6 @@ cd $ZIGDIR
1717
18# Make the `zig version` number consistent.18# Make the `zig version` number consistent.
19# This will affect the cmake command below.19# This will affect the cmake command below.
20git config core.abbrev 9
21git fetch --unshallow || true20git fetch --unshallow || true
22git fetch --tags21git fetch --tags
2322
ci/aarch64-macos-release.sh-1
...@@ -17,7 +17,6 @@ cd $ZIGDIR...@@ -17,7 +17,6 @@ cd $ZIGDIR
1717
18# Make the `zig version` number consistent.18# Make the `zig version` number consistent.
19# This will affect the cmake command below.19# This will affect the cmake command below.
20git config core.abbrev 9
21git fetch --unshallow || true20git fetch --unshallow || true
22git fetch --tags21git fetch --tags
2322
ci/aarch64-windows.ps1-1
...@@ -24,7 +24,6 @@ function CheckLastExitCode {...@@ -24,7 +24,6 @@ function CheckLastExitCode {
2424
25# Make the `zig version` number consistent.25# Make the `zig version` number consistent.
26# This will affect the `zig build` command below which uses `git describe`.26# This will affect the `zig build` command below which uses `git describe`.
27git config core.abbrev 9
28git fetch --tags27git fetch --tags
2928
30if ((git rev-parse --is-shallow-repository) -eq "true") {29if ((git rev-parse --is-shallow-repository) -eq "true") {
ci/x86_64-linux-debug.sh-1
...@@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64...@@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64
1616
17# Make the `zig version` number consistent.17# Make the `zig version` number consistent.
18# This will affect the cmake command below.18# This will affect the cmake command below.
19git config core.abbrev 9
20git fetch --unshallow || true19git fetch --unshallow || true
21git fetch --tags20git fetch --tags
2221
ci/x86_64-linux-release.sh-1
...@@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64...@@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64
1616
17# Make the `zig version` number consistent.17# Make the `zig version` number consistent.
18# This will affect the cmake command below.18# This will affect the cmake command below.
19git config core.abbrev 9
20git fetch --unshallow || true19git fetch --unshallow || true
21git fetch --tags20git fetch --tags
2221
ci/x86_64-macos-release.sh-1
...@@ -22,7 +22,6 @@ cd $ZIGDIR...@@ -22,7 +22,6 @@ cd $ZIGDIR
2222
23# Make the `zig version` number consistent.23# Make the `zig version` number consistent.
24# This will affect the cmake command below.24# This will affect the cmake command below.
25git config core.abbrev 9
26git fetch --unshallow || true25git fetch --unshallow || true
27git fetch --tags26git fetch --tags
2827
ci/x86_64-windows-debug.ps1-1
...@@ -23,7 +23,6 @@ function CheckLastExitCode {...@@ -23,7 +23,6 @@ function CheckLastExitCode {
2323
24# Make the `zig version` number consistent.24# Make the `zig version` number consistent.
25# This will affect the `zig build` command below which uses `git describe`.25# This will affect the `zig build` command below which uses `git describe`.
26git config core.abbrev 9
27git fetch --tags26git fetch --tags
2827
29if ((git rev-parse --is-shallow-repository) -eq "true") {28if ((git rev-parse --is-shallow-repository) -eq "true") {
ci/x86_64-windows-release.ps1-1
...@@ -23,7 +23,6 @@ function CheckLastExitCode {...@@ -23,7 +23,6 @@ function CheckLastExitCode {
2323
24# Make the `zig version` number consistent.24# Make the `zig version` number consistent.
25# This will affect the `zig build` command below which uses `git describe`.25# This will affect the `zig build` command below which uses `git describe`.
26git config core.abbrev 9
27git fetch --tags26git fetch --tags
2827
29if ((git rev-parse --is-shallow-repository) -eq "true") {28if ((git rev-parse --is-shallow-repository) -eq "true") {