]> Kevux Git Server - rit/commitdiff
help: add a build option for default hash
authorbrian m. carlson <sandals@crustytoothpaste.net>
Tue, 1 Jul 2025 21:22:36 +0000 (21:22 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 1 Jul 2025 21:58:26 +0000 (14:58 -0700)
We'd like users to be able to determine the hash algorithm that is the
builtin default in their version of Git.  This is useful for
troubleshooting, especially when we decide to change the default.  Add
an entry for the default hash in the output of git version
--build-options so that users can easily access that information and
include it in bug reports.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
help.c

diff --git a/help.c b/help.c
index 21b7787..bd0be2e 100644 (file)
--- a/help.c
+++ b/help.c
@@ -810,6 +810,7 @@ void get_version_info(struct strbuf *buf, int show_build_options)
                            SHA1_UNSAFE_BACKEND);
 #endif
                strbuf_addf(buf, "SHA-256: %s\n", SHA256_BACKEND);
+               strbuf_addf(buf, "default-hash: %s\n", hash_algos[GIT_HASH_DEFAULT].name);
        }
 }