]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fetch-pack: detect when the server doesn't support our hash
authorbrian m. carlson <sandals@crustytoothpaste.net>
Mon, 25 May 2020 19:58:59 +0000 (19:58 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 May 2020 17:07:06 +0000 (10:07 -0700)
Detect when the server doesn't support our hash algorithm and abort.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch-pack.c

index f73a2ce6cba2af20669c9bf98acabb878725a0a7..1d277190e7c546cfe774d7f5ad900101d4031f51 100644 (file)
@@ -1039,6 +1039,8 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
                print_verbose(args, _("Server supports %s"), "deepen-relative");
        else if (args->deepen_relative)
                die(_("Server does not support --deepen"));
+       if (!server_supports_hash(the_hash_algo->name, NULL))
+               die(_("Server does not support this repository's object format"));
 
        if (!args->no_dependents) {
                mark_complete_and_common_ref(negotiator, args, &ref);