Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-07-07 08:09:13 +0300
committerJunio C Hamano <gitster@pobox.com>2020-07-07 08:09:13 +0300
commit12210859da0c16c644dab658d9e1ef671ec28788 (patch)
treee8035e6e8412b45972e8836399f531c6379313f8 /send-pack.c
parenta08a83db2bf27f015bec9a435f6d73e223c21c5e (diff)
parent3716d50dd5c8ee7e5ccaa89fcbfff2cd1b82ad1d (diff)
Merge branch 'bc/sha-256-part-2'
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 ...
Diffstat (limited to 'send-pack.c')
-rw-r--r--send-pack.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/send-pack.c b/send-pack.c
index 0abee22283..02aefcb08e 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -363,6 +363,7 @@ int send_pack(struct send_pack_args *args,
int atomic_supported = 0;
int use_push_options = 0;
int push_options_supported = 0;
+ int object_format_supported = 0;
unsigned cmds_sent = 0;
int ret;
struct async demux;
@@ -389,6 +390,9 @@ int send_pack(struct send_pack_args *args,
if (server_supports("push-options"))
push_options_supported = 1;
+ if (!server_supports_hash(the_hash_algo->name, &object_format_supported))
+ die(_("the receiving end does not support this repository's hash algorithm"));
+
if (args->push_cert != SEND_PACK_PUSH_CERT_NEVER) {
int len;
push_cert_nonce = server_feature_value("push-cert", &len);
@@ -429,6 +433,8 @@ int send_pack(struct send_pack_args *args,
strbuf_addstr(&cap_buf, " atomic");
if (use_push_options)
strbuf_addstr(&cap_buf, " push-options");
+ if (object_format_supported)
+ strbuf_addf(&cap_buf, " object-format=%s", the_hash_algo->name);
if (agent_supported)
strbuf_addf(&cap_buf, " agent=%s", git_user_agent_sanitized());