mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
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.
This commit is contained in:
parent
90a19f7411
commit
f545fc28b3
12 changed files with 9 additions and 12 deletions
|
|
@ -45,7 +45,7 @@ if("${ZIG_VERSION}" STREQUAL "")
|
|||
find_program(GIT_EXE NAMES git NAMES_PER_DIR)
|
||||
if(GIT_EXE)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXE} -C ${CMAKE_SOURCE_DIR} describe --match *.*.* --tags
|
||||
COMMAND ${GIT_EXE} -C ${CMAKE_SOURCE_DIR} describe --match *.*.* --tags --abbrev=9
|
||||
RESULT_VARIABLE EXIT_STATUS
|
||||
OUTPUT_VARIABLE GIT_DESCRIBE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
|
|
|
|||
|
|
@ -263,7 +263,14 @@ pub fn build(b: *std.Build) !void {
|
|||
|
||||
var code: u8 = undefined;
|
||||
const git_describe_untrimmed = b.runAllowFail(&[_][]const u8{
|
||||
"git", "-C", b.build_root.path orelse ".", "describe", "--match", "*.*.*", "--tags",
|
||||
"git",
|
||||
"-C",
|
||||
b.build_root.path orelse ".",
|
||||
"describe",
|
||||
"--match",
|
||||
"*.*.*",
|
||||
"--tags",
|
||||
"--abbrev=9",
|
||||
}, &code, .Ignore) catch {
|
||||
break :v version_string;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH"
|
|||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH"
|
|||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ cd $ZIGDIR
|
|||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ cd $ZIGDIR
|
|||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ function CheckLastExitCode {
|
|||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the `zig build` command below which uses `git describe`.
|
||||
git config core.abbrev 9
|
||||
git fetch --tags
|
||||
|
||||
if ((git rev-parse --is-shallow-repository) -eq "true") {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64
|
|||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64
|
|||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ cd $ZIGDIR
|
|||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ function CheckLastExitCode {
|
|||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the `zig build` command below which uses `git describe`.
|
||||
git config core.abbrev 9
|
||||
git fetch --tags
|
||||
|
||||
if ((git rev-parse --is-shallow-repository) -eq "true") {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ function CheckLastExitCode {
|
|||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the `zig build` command below which uses `git describe`.
|
||||
git config core.abbrev 9
|
||||
git fetch --tags
|
||||
|
||||
if ((git rev-parse --is-shallow-repository) -eq "true") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue