]> git.ipfire.org Git - thirdparty/git.git/commitdiff
help: print zlib-ng version number
authorToon Claes <toon@iotcl.com>
Fri, 7 Mar 2025 14:18:08 +0000 (15:18 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 7 Mar 2025 20:23:30 +0000 (12:23 -0800)
When building against zlib-ng, the header file `zlib.h` is not included,
but `zlib-ng.h` is included instead. It's `zlib.h` that defines
`ZLIB_VERSION` and that macro is used to print out zlib version in
`git-version(1)` with `--build-options`. But when it's not defined, no
version is printed.

`zlib-ng.h` defines another macro: `ZLIBNG_VERSION`. Use that macro to
print the zlib-ng version in `git version --build-options` when it's
set. Otherwise fallback to `ZLIB_VERSION`.

Signed-off-by: Toon Claes <toon@iotcl.com>
Helped-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
help.c
t/t0091-bugreport.sh

diff --git a/help.c b/help.c
index d3d3adcc5c16c164348df1e4b70f5cbc60016d9b..a08c645fd97c372093dd8880e8d13b46c71822b8 100644 (file)
--- a/help.c
+++ b/help.c
@@ -776,7 +776,9 @@ void get_version_info(struct strbuf *buf, int show_build_options)
 #if defined OPENSSL_VERSION_TEXT
                strbuf_addf(buf, "OpenSSL: %s\n", OPENSSL_VERSION_TEXT);
 #endif
-#if defined ZLIB_VERSION
+#if defined ZLIBNG_VERSION
+               strbuf_addf(buf, "zlib-ng: %s\n", ZLIBNG_VERSION);
+#elif defined ZLIB_VERSION
                strbuf_addf(buf, "zlib: %s\n", ZLIB_VERSION);
 #endif
        }
index e11d819b62a15087575d639b28be3c64fcd06386..e38ca7a901875168077acbaac143abc5c1d096c6 100755 (executable)
@@ -47,7 +47,8 @@ test_expect_success 'sanity check "System Info" section' '
        # This is bound to differ from environment to environment,
        # so we just do some rather high-level checks.
        grep "uname: ." system &&
-       grep "compiler info: ." system
+       grep "compiler info: ." system &&
+       grep "zlib." system
 '
 
 test_expect_success 'dies if file with same name as report already exists' '