]> git.ipfire.org Git - thirdparty/git.git/commitdiff
remote-curl: fix clone on sha256 repos
authorEric Wong <e@80x24.org>
Tue, 11 May 2021 10:37:30 +0000 (10:37 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 May 2021 03:14:44 +0000 (12:14 +0900)
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

Signed-off-by: Eric Wong <e@80x24.org>
Acked-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote-curl.c

index 0290b04891596bd4ebed0154c25b0713acd30d08..9d432c299a242e4f0b337756bc6aedfcc5be45b8 100644 (file)
@@ -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)