Subject: Re: [PATCH] remote-curl: set fallback hash algorithm outside repo

From: "brian m. carlson" <[email-masked]>
Date: Sat, 21 Mar 2026 23:09:16 +0000

On 2026-03-21 at 19:46:53, K Jayatheerth wrote:
> diff --git a/remote-curl.c b/remote-curl.c
> index 92e40bb682..4c85e6b079 100644
> --- a/remote-curl.c
> +++ b/remote-curl.c
> @@ -1547,6 +1547,10 @@ int cmd_main(int argc, const char **argv)
>  	int ret = 1;
>  
>  	setup_git_directory_gently(&nongit);
> +
> +	if (nongit && !the_repository->hash_algo)
> +		repo_set_hash_algo(the_repository, GIT_HASH_SHA1);

This should be GIT_HASH_DEFAULT, which is whatever the default hash is.

GIT_HASH_SHA1_LEGACY is for places where we assume SHA-1 because the
data format doesn't specify (e.g., v1 bundles) and GIT_HASH_SHA1 says,
“The user or data format specifically chose SHA-1.”  The user didn't
specify any particular algorithm here (which is the problem), so we
should go with the default (which will change to SHA-256 in 3.0).

That being said, I also agree with Peff downthread that it might be
better to fix this elsewhere,
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA