summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2020-05-25 19:59:17 +0000
committerJunio C Hamano <gitster@pobox.com>2020-05-27 10:07:07 -0700
commit9de0dd361c9ea2ca6eca14a7dd43fe11d170a253 (patch)
tree922a7a597fbb1ed8677972756cfebf098d0a228c /connect.c
parentab67235bc4900d8203a1a6b6f33cf8afa845e43e (diff)
downloadgit-9de0dd361c9ea2ca6eca14a7dd43fe11d170a253.tar.gz
serve: advertise object-format capability for protocol v2
In order to communicate the protocol supported by the server side, add support for advertising the object-format capability. We check that the client side sends us an identical algorithm if it sends us its own object-format capability, and assume it speaks SHA-1 if not. In the test, when we're using an algorithm other than SHA-1, we need to specify the algorithm in use so we don't get a failure with an "unknown format" message. Add a test that we handle a mismatched algorithm. Remove the test_oid_init call since it's no longer necessary. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/connect.c b/connect.c
index 66650ff2d3..2ada5b5161 100644
--- a/connect.c
+++ b/connect.c
@@ -460,6 +460,8 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
die(_("unknown object format '%s' specified by server"), hash_name);
reader->hash_algo = &hash_algos[hash_algo];
packet_write_fmt(fd_out, "object-format=%s", reader->hash_algo->name);
+ } else {
+ reader->hash_algo = &hash_algos[GIT_HASH_SHA1];
}
if (server_options && server_options->nr &&