fetch-pack: use unsigned int for hash_algo variable

hash_algo_by_name() returns unsigned int, but it is stored in hash_algo variable as int. This goes unnoticed because of: DISABLE_SIGN_COMPARE_WARNINGS On 'fetch-pack.c' On a subsequent commit this function will be moved to 'connect.c' that would notice this. Change hash_algo variable type to match its return type, also make it const because they are never modified. Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pablo Sabater committed Jul 24, 2026 at 12:54 UTC b72559caa4ca3733b7694fa27364c4a9ac364159
1 file changed +1 -1
fetch-pack.c
+1 -1
@@ -1397,7 +1397,7 @@ static void write_fetch_command_and_capabilities(struct strbuf *req_buf,
1397 }
1398
1399 if (server_feature_v2("object-format", &hash_name)) {
1400 - int hash_algo = hash_algo_by_name(hash_name);
1400 + const unsigned int hash_algo = hash_algo_by_name(hash_name);
1401 if (hash_algo_by_ptr(the_hash_algo) != hash_algo)
1402 die(_("mismatched algorithms: client %s; server %s"),
1403 the_hash_algo->name, hash_name);