git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Mar 21, 2026, 23:09 UTC
Message-ID
<ab8lHBDvjTjatE9s@fruit.crustytoothpaste.net>
In-Reply-To
<20260321194653.24513-1-jayatheerthkulkarni2005@gmail.com>
On 2026-03-21 at 19:46:53, K Jayatheerth wrote:
Show 11 quoted lines
> 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
Previous: K JayatheerthNext: K Jayatheerth
Message 3 of 17 in “remote-curl: segfault parsing remote.<name>.fetch outside a repository”
  1. Jo LissMar 21, 2026
  2. remote-curl: set fallback hash algorithm outside repoK Jayatheerth, Mar 21, 2026
  3. brian m. carlsonMar 21, 2026
  4. refspec: safely parse refspecs outside a repositoryK Jayatheerth, Mar 22, 2026
  5. Junio C HamanoMar 22, 2026
  6. Jeff KingMar 22, 2026
  7. 1/2 refspec: safely parse refspecs outside a repositoryK Jayatheerth, Mar 22, 2026
  8. 2/2 refspec: fix typo in commentK Jayatheerth, Mar 22, 2026
  9. Junio C HamanoMar 23, 2026
  10. Jeff KingMar 23, 2026
  11. Junio C HamanoMar 23, 2026
  12. 1/2 remote-curl: fall back to default hash outside repoK Jayatheerth, Mar 24, 2026
  13. 2/2 refspec: fix typo in commentK Jayatheerth, Mar 24, 2026
  14. Junio C HamanoMar 24, 2026
  15. Jeff KingMar 21, 2026
  16. Junio C HamanoMar 22, 2026
  17. Jeff KingMar 22, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.