Skip to content

Commit bf30dbf

Browse files
bk2204gitster
authored andcommitted
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>
1 parent 14570dc commit bf30dbf

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

builtin/receive-pack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ static void show_ref(const char *path, const struct object_id *oid)
248248
strbuf_addf(&cap, " push-cert=%s", push_cert_nonce);
249249
if (advertise_push_options)
250250
strbuf_addstr(&cap, " push-options");
251+
strbuf_addf(&cap, " object-format=%s", the_hash_algo->name);
251252
strbuf_addf(&cap, " agent=%s", git_user_agent_sanitized());
252253
packet_write_fmt(1, "%s %s%c%s\n",
253254
oid_to_hex(oid), path, 0, cap.buf);

upload-pack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
10051005
struct strbuf symref_info = STRBUF_INIT;
10061006

10071007
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",
10091009
oid_to_hex(oid), refname_nons,
10101010
0, capabilities,
10111011
(allow_unadvertised_object_request & ALLOW_TIP_SHA1) ?
@@ -1015,6 +1015,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
10151015
stateless_rpc ? " no-done" : "",
10161016
symref_info.buf,
10171017
allow_filter ? " filter" : "",
1018+
the_hash_algo->name,
10181019
git_user_agent_sanitized());
10191020
strbuf_release(&symref_info);
10201021
} else {

0 commit comments

Comments
 (0)