@matheusbsbs / matheus-bagliano / commits / bf30dbf826
Fork 0

remote: advertise the object-format capability on the server side

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>

brian m. carlson committed May 25, 2020 at 19:58 UTC bf30dbf82611e3bb7e2bbac1d38bb38ad10c8636
2 files changed +3 -1
builtin/receive-pack.c
+1
@@ -248,6 +248,7 @@ static void show_ref(const char *path, const struct object_id *oid)
248 strbuf_addf(&cap, " push-cert=%s", push_cert_nonce);
249 if (advertise_push_options)
250 strbuf_addstr(&cap, " push-options");
251 + strbuf_addf(&cap, " object-format=%s", the_hash_algo->name);
252 strbuf_addf(&cap, " agent=%s", git_user_agent_sanitized());
253 packet_write_fmt(1, "%s %s%c%s\n",
254 oid_to_hex(oid), path, 0, cap.buf);
upload-pack.c
+2 -1
@@ -1005,7 +1005,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
1005 struct strbuf symref_info = STRBUF_INIT;
1006
1007 format_symref_info(&symref_info, cb_data);
1008 - packet_write_fmt(1, "%s %s%c%s%s%s%s%s%s agent=%s\n",
1008 + packet_write_fmt(1, "%s %s%c%s%s%s%s%s%s object-format=%s agent=%s\n",
1009 oid_to_hex(oid), refname_nons,
1010 0, capabilities,
1011 (allow_unadvertised_object_request & ALLOW_TIP_SHA1) ?
@@ -1015,6 +1015,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
1015 stateless_rpc ? " no-done" : "",
1016 symref_info.buf,
1017 allow_filter ? " filter" : "",
1018 + the_hash_algo->name,
1019 git_user_agent_sanitized());
1020 strbuf_release(&symref_info);
1021 } else {