Merge branch 'bc/sha-256-part-2' into jch
SHA-256 migration work continues. * bc/sha-256-part-2: (44 commits) remote-testgit: adapt for object-format bundle: detect hash algorithm when reading refs t5300: pass --object-format to git index-pack t5704: send object-format capability with SHA-256 t5703: use object-format serve option t5702: offer an object-format capability in the test t/helper: initialize the repository for test-sha1-array remote-curl: avoid truncating refs with ls-remote t1050: pass algorithm to index-pack when outside repo builtin/index-pack: add option to specify hash algorithm remote-curl: detect algorithm for dumb HTTP by size builtin/ls-remote: initialize repository based on fetch t5500: make hash independent serve: advertise object-format capability for protocol v2 connect: parse v2 refs with correct hash algorithm connect: pass full packet reader when parsing v2 refs Documentation/technical: document object-format for protocol v2 t1302: expect repo format version 1 for SHA-256 builtin/show-index: provide options to determine hash algo t5302: modernize test formatting ...
This commit is contained in:
14
fetch-pack.c
14
fetch-pack.c
@ -1050,6 +1050,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);
|
||||
@ -1188,6 +1190,7 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
|
||||
int sideband_all, int seen_ack)
|
||||
{
|
||||
int ret = 0;
|
||||
const char *hash_name;
|
||||
struct strbuf req_buf = STRBUF_INIT;
|
||||
|
||||
if (server_supports_v2("fetch", 1))
|
||||
@ -1202,6 +1205,17 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
|
||||
args->server_options->items[i].string);
|
||||
}
|
||||
|
||||
if (server_feature_v2("object-format", &hash_name)) {
|
||||
int hash_algo = hash_algo_by_name(hash_name);
|
||||
if (hash_algo_by_ptr(the_hash_algo) != hash_algo)
|
||||
die(_("mismatched algorithms: client %s; server %s"),
|
||||
the_hash_algo->name, hash_name);
|
||||
packet_write_fmt(fd_out, "object-format=%s", the_hash_algo->name);
|
||||
} else if (hash_algo_by_ptr(the_hash_algo) != GIT_HASH_SHA1) {
|
||||
die(_("the server does not support algorithm '%s'"),
|
||||
the_hash_algo->name);
|
||||
}
|
||||
|
||||
packet_buf_delim(&req_buf);
|
||||
if (args->use_thin_pack)
|
||||
packet_buf_write(&req_buf, "thin-pack");
|
||||
|
Reference in New Issue
Block a user