Skip to content

Commit 2b1e0f8

Browse files
To1negitster
authored andcommitted
help: print zlib-ng version number
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 <[email protected]> Helped-by: Patrick Steinhardt <[email protected]> Reviewed-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 49d9cd8 commit 2b1e0f8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

help.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,9 @@ void get_version_info(struct strbuf *buf, int show_build_options)
776776
#if defined OPENSSL_VERSION_TEXT
777777
strbuf_addf(buf, "OpenSSL: %s\n", OPENSSL_VERSION_TEXT);
778778
#endif
779-
#if defined ZLIB_VERSION
779+
#if defined ZLIBNG_VERSION
780+
strbuf_addf(buf, "zlib-ng: %s\n", ZLIBNG_VERSION);
781+
#elif defined ZLIB_VERSION
780782
strbuf_addf(buf, "zlib: %s\n", ZLIB_VERSION);
781783
#endif
782784
}

t/t0091-bugreport.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ test_expect_success 'sanity check "System Info" section' '
4747
# This is bound to differ from environment to environment,
4848
# so we just do some rather high-level checks.
4949
grep "uname: ." system &&
50-
grep "compiler info: ." system
50+
grep "compiler info: ." system &&
51+
grep "zlib." system
5152
'
5253

5354
test_expect_success 'dies if file with same name as report already exists' '

0 commit comments

Comments
 (0)