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:
@ -249,6 +249,7 @@ static void show_ref(const char *path, const struct object_id *oid)
|
||||
strbuf_addf(&cap, " push-cert=%s", push_cert_nonce);
|
||||
if (advertise_push_options)
|
||||
strbuf_addstr(&cap, " push-options");
|
||||
strbuf_addf(&cap, " object-format=%s", the_hash_algo->name);
|
||||
strbuf_addf(&cap, " agent=%s", git_user_agent_sanitized());
|
||||
packet_write_fmt(1, "%s %s%c%s\n",
|
||||
oid_to_hex(oid), path, 0, cap.buf);
|
||||
@ -1624,6 +1625,8 @@ static struct command *read_head_info(struct packet_reader *reader,
|
||||
linelen = strlen(reader->line);
|
||||
if (linelen < reader->pktlen) {
|
||||
const char *feature_list = reader->line + linelen + 1;
|
||||
const char *hash = NULL;
|
||||
int len = 0;
|
||||
if (parse_feature_request(feature_list, "report-status"))
|
||||
report_status = 1;
|
||||
if (parse_feature_request(feature_list, "side-band-64k"))
|
||||
@ -1636,6 +1639,13 @@ static struct command *read_head_info(struct packet_reader *reader,
|
||||
if (advertise_push_options
|
||||
&& parse_feature_request(feature_list, "push-options"))
|
||||
use_push_options = 1;
|
||||
hash = parse_feature_value(feature_list, "object-format", &len, NULL);
|
||||
if (!hash) {
|
||||
hash = hash_algos[GIT_HASH_SHA1].name;
|
||||
len = strlen(hash);
|
||||
}
|
||||
if (xstrncmpz(the_hash_algo->name, hash, len))
|
||||
die("error: unsupported object format '%s'", hash);
|
||||
}
|
||||
|
||||
if (!strcmp(reader->line, "push-cert")) {
|
||||
|
Reference in New Issue
Block a user