On Mon, Jul 13, 2020 at 02:49:01AM +0000, brian m. carlson wrote: > @@ -23,17 +24,20 @@ static void add_to_ref_list(const struct object_id *oid, const char *name, > list->nr++; > } > > -static const struct git_hash_algo *detect_hash_algo(struct strbuf *buf) > +static int parse_capability(struct bundle_header *header, const char *capability) > { > - size_t len = strcspn(buf->buf, " \n"); > - int algo; > - > - algo = hash_algo_by_length(len / 2); > - if (algo == GIT_HASH_UNKNOWN) > - return NULL; > - return &hash_algos[algo]; > + const char *arg; > + if (skip_prefix(capability, "object-format=", &arg)) { > + int algo = hash_algo_by_name(arg); > + if (algo == GIT_HASH_UNKNOWN) > + return error(_("unable to detect hash algorithm")); > + header->hash_algo = &hash_algos[algo]; > + return 0; > + } > + return error(_("unknown capability '%s'"), capability); > } > +test_expect_success 'git bundle v3 rejects unknown extensions' ' > + head -n2 bundle >new && > + echo "@unknown=silly" >>new && > + sed "1,2d" >>new && > + test_must_fail git bundle verify new 2>output && > + grep "unknown capability .unknown=silly." output This "unknown capability" error message is translated, so it should be checked with 'test_i18ngrep'. > +' > + > test_done