From: Junio C Hamano Date: Mon, 27 Jul 2026 16:08:58 +0000 (-0700) Subject: Merge branch 'jc/submodule-helper-avoid-zu' X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=f931547dff983c5592e78f99a4d5b9361f4b3bfc;p=thirdparty%2Fgit.git Merge branch 'jc/submodule-helper-avoid-zu' An accidental use of the '%zu' format specifier in 'git submodule--helper' has been corrected to use 'PRIuMAX' and cast the value to 'uintmax_t' to avoid portability issues. * jc/submodule-helper-avoid-zu: submodule--helper: avoid use of %zu for now --- f931547dff983c5592e78f99a4d5b9361f4b3bfc diff --cc builtin/submodule--helper.c index 2b3c9762af,49463b7d2b..65222706ea --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@@ -549,12 -549,13 +549,13 @@@ static void create_default_gitdir_confi } /* Case 2.4: If all the above failed, try a hash of the name as a last resort */ - header_len = snprintf(header, sizeof(header), "blob %zu", strlen(submodule_name)); + header_len = snprintf(header, sizeof(header), + "blob %"PRIuMAX, (uintmax_t)strlen(submodule_name)); - the_hash_algo->init_fn(&ctx); - the_hash_algo->update_fn(&ctx, header, header_len); - the_hash_algo->update_fn(&ctx, "\0", 1); - the_hash_algo->update_fn(&ctx, submodule_name, strlen(submodule_name)); - the_hash_algo->final_fn(raw_name_hash, &ctx); + git_hash_init(&ctx, the_hash_algo); + git_hash_update(&ctx, header, header_len); + git_hash_update(&ctx, "\0", 1); + git_hash_update(&ctx, submodule_name, strlen(submodule_name)); + git_hash_final(raw_name_hash, &ctx); hash_to_hex_algop_r(hex_name_hash, raw_name_hash, the_hash_algo); strbuf_reset(&gitdir_path); repo_git_path_append(the_repository, &gitdir_path, "modules/%s", hex_name_hash);