When the `--build-options` flag is used with git-version(1), additional information about the built version of Git is printed. During build time, different SHA implementations may be configured, but this information is not included in the version info. Add the SHA implementations Git is built with to the version info. Signed-off-by: Justin Tobler <jltobler@xxxxxxxxx> --- help.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/help.c b/help.c index c54bd9918a..32b5d4e6f5 100644 --- a/help.c +++ b/help.c @@ -768,6 +768,33 @@ char *help_unknown_cmd(const char *cmd) exit(1); } +static void get_sha_impl(struct strbuf *buf) +{ +#if defined(SHA1_OPENSSL) + strbuf_addstr(buf, "SHA-1: OpenSSL\n"); +#elif defined(SHA1_BLK) + strbuf_addstr(buf, "SHA-1: blk\n"); +#elif defined(SHA1_APPLE) + strbuf_addstr(buf, "SHA-1: Apple CommonCrypto\n"); +#elif defined(DC_SHA1_EXTERNAL) + strbuf_addstr(buf, "SHA-1: Collision Detection (External)\n"); +#elif defined(DC_SHA1_SUBMODULE) + strbuf_addstr(buf, "SHA-1: Collision Detection (Submodule)\n"); +#elif defined(SHA1_DC) + strbuf_addstr(buf, "SHA-1: Collision Detection\n"); +#endif + +#if defined(SHA256_OPENSSL) + strbuf_addstr(buf, "SHA-256: OpenSSL\n"); +#elif defined(SHA256_NETTLE) + strbuf_addstr(buf, "SHA-256: Nettle\n"); +#elif defined(SHA256_GCRYPT) + strbuf_addstr(buf, "SHA-256: gcrypt\n"); +#elif defined(SHA256_BLK) + strbuf_addstr(buf, "SHA-256: blk\n"); +#endif +} + void get_version_info(struct strbuf *buf, int show_build_options) { /* @@ -803,6 +830,7 @@ void get_version_info(struct strbuf *buf, int show_build_options) #elif defined ZLIB_VERSION strbuf_addf(buf, "zlib: %s\n", ZLIB_VERSION); #endif + get_sha_impl(buf); } } -- 2.49.0