git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Eric Wong <e@80x24.org>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] remote-curl: fix clone on sha256 repos
Date: Tue, 11 May 2021 23:01:50 +0000	[thread overview]
Message-ID: <YJsM3sUXRYjJiwZG@camp.crustytoothpaste.net> (raw)
In-Reply-To: <20210511103730.GA15003@dcvr>

[-- Attachment #1: Type: text/plain, Size: 2012 bytes --]

On 2021-05-11 at 10:37:30, Eric Wong wrote:
> I'm not very familiar with the way some of this stuff works, but
> the patch below seems to fix clone for me.
> 
> I originally tried changing the cmd_main->set_option code path,
> but value is always set to "true" for object-format because
> it only sees "option object-format" with no arg
> 
> 		} else if (skip_prefix(buf.buf, "option ", &arg)) {
> 			char *value = strchr(arg, ' ');
> 			int result;
> 
> 			if (value)
> 				*value++ = '\0';
> 			else
> 				value = "true";
> 
> 			result = set_option(arg, value);
> 
> So when set_option gets called, hash_algo_by_name isn't:
> 
> 	} else if (!strcmp(name, "object-format")) {
> 		int algo;
> 		options.object_format = 1;
> 		if (strcmp(value, "true")) {
> 			/* XXX this branch is never taken: */
> 			algo = hash_algo_by_name(value);
> 			if (algo == GIT_HASH_UNKNOWN)
> 				die("unknown object format '%s'", value);
> 			options.hash_algo = &hash_algos[algo];
> 		}
> 		return 0;
> 
> So I'm not sure if the above is incomplete or dead code.
> Anyways, I arrived at the following and it works for me:
> 
> -----------8<---------
> Subject: [PATCH] remote-curl: fix clone on sha256 repos
> 
> 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().

This seems fine as a solution for now.  I tried to keep the transport
code mostly independent of the local repository settings, but in this
case because the HTTP walker mucks around with the internals of the
local pack files, I don't think we can avoid this without some major
restructuring, which I'm not interested in sitting down and writing this
evening.

I'll clean this up in a nicer way once I get interop working.  Thanks
for sending a patch for this.
-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  parent reply	other threads:[~2021-05-11 23:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 10:37 [PATCH] remote-curl: fix clone on sha256 repos Eric Wong
2021-05-11 13:36 ` Junio C Hamano
2021-05-11 14:47 ` Ævar Arnfjörð Bjarmason
2021-05-11 18:25   ` Jeff King
2021-05-11 21:02     ` Junio C Hamano
2021-05-11 21:23     ` Jeff King
2021-05-11 23:04     ` brian m. carlson
2021-05-11 23:01 ` brian m. carlson [this message]
2021-05-11 23:48   ` Junio C Hamano
2021-05-11 23:51     ` brian m. carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YJsM3sUXRYjJiwZG@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).