]> git.ipfire.org Git - thirdparty/git.git/commitdiff
remote: advertise the object-format capability on the server side
authorbrian m. carlson <sandals@crustytoothpaste.net>
Mon, 25 May 2020 19:58:51 +0000 (19:58 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 May 2020 17:07:06 +0000 (10:07 -0700)
Advertise the current hash algorithm in use by using the object-format
capability as part of the ref advertisement.

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

index d37ab776b3f59313c99324faea0034e4cb173d82..a4159b559e9679cd2038ac95f9eaefb99231c5f6 100644 (file)
@@ -248,6 +248,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);
index 902d0ad5e157fde33ec013476086740946e285df..df6cb51db7c7b7e7054087ca74909ad03f19f145 100644 (file)
@@ -1005,7 +1005,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
                struct strbuf symref_info = STRBUF_INIT;
 
                format_symref_info(&symref_info, cb_data);
-               packet_write_fmt(1, "%s %s%c%s%s%s%s%s%s agent=%s\n",
+               packet_write_fmt(1, "%s %s%c%s%s%s%s%s%s object-format=%s agent=%s\n",
                             oid_to_hex(oid), refname_nons,
                             0, capabilities,
                             (allow_unadvertised_object_request & ALLOW_TIP_SHA1) ?
@@ -1015,6 +1015,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
                             stateless_rpc ? " no-done" : "",
                             symref_info.buf,
                             allow_filter ? " filter" : "",
+                            the_hash_algo->name,
                             git_user_agent_sanitized());
                strbuf_release(&symref_info);
        } else {