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

Re: [PATCH] remote-curl: fix clone on sha256 repos

From
Junio C Hamano <gitster@pobox.com>
Date
May 11, 2021, 13:36 UTC
Message-ID
<xmqqy2cll7d8.fsf@gitster.g>
In-Reply-To
<20210511103730.GA15003@dcvr>
Eric Wong <e@80x24.org> writes:
Show 12 quoted lines
> The remote-https process needs to update it's own instance of
> `the_repository' when it sees an HTTP(S) remote is using sha256.
> Without this, parse_oid_hex() fails to handle sha256 OIDs when
> it's eventually called by parse_fetch().
>
> Tested with:
>
> 	git clone https://yhbt.net/sha256test.git
> 	GIT_SMART_HTTP=0 git clone https://yhbt.net/sha256test.git
> 	(plain http:// also works)
>
> Cloning the URL via git:// required no changes

OK, so smart-http is disabled because it is just a slight variation of the native Git protocol in disguise running over the http transport, while the non-smart-http uses totally different codepath to initialize the repository, and this bug does not appear when the native Git protocol is in use?

I guess we use "git clone" over HTTP in many place in our tests, so there is no need to add a new one to safeguard this fix from future breakage (instead we can just run the whole test suite with SHA256)?

Will wait for brian to comment.
Thanks.
Show 18 quoted lines
> Signed-off-by: Eric Wong <e@80x24.org>
> ---
>  remote-curl.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/remote-curl.c b/remote-curl.c
> index 0290b04891..9d432c299a 100644
> --- a/remote-curl.c
> +++ b/remote-curl.c
> @@ -555,6 +555,8 @@ static void output_refs(struct ref *refs)
>  	struct ref *posn;
>  	if (options.object_format && options.hash_algo) {
>  		printf(":object-format %s\n", options.hash_algo->name);
> +		repo_set_hash_algo(the_repository,
> +				hash_algo_by_ptr(options.hash_algo));
>  	}
>  	for (posn = refs; posn; posn = posn->next) {
>  		if (posn->symref)
Previous: Eric WongNext: Ævar Arnfjörð Bjarmason
Message 2 of 10 in “remote-curl: fix clone on sha256 repos”
  1. remote-curl: fix clone on sha256 reposEric Wong, May 11, 2021
  2. Junio C HamanoMay 11, 2021
  3. Ævar Arnfjörð BjarmasonMay 11, 2021
  4. Jeff KingMay 11, 2021
  5. Junio C HamanoMay 11, 2021
  6. Jeff KingMay 11, 2021
  7. brian m. carlsonMay 11, 2021
  8. brian m. carlsonMay 11, 2021
  9. Junio C HamanoMay 11, 2021
  10. brian m. carlsonMay 11, 2021

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.