git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Toon Claes <toon@iotcl.com>
To: git@vger.kernel.org
Cc: Patrick Steinhardt <ps@pks.im>, Toon Claes <toon@iotcl.com>
Subject: [PATCH 2/2] help: print zlib-ng version number
Date: Fri, 07 Mar 2025 15:18:08 +0100	[thread overview]
Message-ID: <20250307-toon-zlib-git-version-v1-2-5e8069752bb9@iotcl.com> (raw)
In-Reply-To: <20250307-toon-zlib-git-version-v1-0-5e8069752bb9@iotcl.com>

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>
---
 help.c               | 4 +++-
 t/t0091-bugreport.sh | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/help.c b/help.c
index 707cd59b79..c54bd9918a 100644
--- a/help.c
+++ b/help.c
@@ -798,7 +798,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
 	}
diff --git a/t/t0091-bugreport.sh b/t/t0091-bugreport.sh
index e11d819b62..e38ca7a901 100755
--- a/t/t0091-bugreport.sh
+++ b/t/t0091-bugreport.sh
@@ -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' '

-- 
2.49.0.rc1.410.g72b47a15e9


  parent reply	other threads:[~2025-03-07 14:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 14:18 [PATCH 0/2] Ensure zlib version is printed by git-version(1) Toon Claes
2025-03-07 14:18 ` [PATCH 1/2] help: include git-zlib.h to print zlib version Toon Claes
2025-03-07 20:25   ` Junio C Hamano
2025-03-07 14:18 ` Toon Claes [this message]
2025-03-07 14:20 ` [PATCH 0/2] Ensure zlib version is printed by git-version(1) Patrick Steinhardt
2025-03-07 20:25   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250307-toon-zlib-git-version-v1-2-5e8069752bb9@iotcl.com \
    --to=toon@iotcl.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).