path: root/transport.c
diff options
authorbrian m. carlson <>2020-05-25 19:58:55 (GMT)
committerJunio C Hamano <>2020-05-27 17:07:06 (GMT)
commit7c97af4d64100bf9ce4b335ee91e743378e2e181 (patch)
treee25661f07b806ecf36ee46eed99b69019a50c334 /transport.c
parent9a9f0d3fc0888599723812be62fa2d7b3cc4d2d6 (diff)
transport: add a hash algorithm member
When connecting to a remote system, we need to know what hash algorithm it will be using to talk to us. Add a hash_algo member to struct transport and add a function to read this data from the transport object. Signed-off-by: brian m. carlson <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'transport.c')
1 files changed, 8 insertions, 0 deletions
diff --git a/transport.c b/transport.c
index 15f5ba4..b43d985 100644
--- a/transport.c
+++ b/transport.c
@@ -311,6 +311,7 @@ static struct ref *handshake(struct transport *transport, int for_push,
BUG("unknown protocol version");
data->got_remote_heads = 1;
+ transport->hash_algo = reader.hash_algo;
if (reader.line_peeked)
BUG("buffer must be empty at the end of handshake()");
@@ -996,9 +997,16 @@ struct transport *transport_get(struct remote *remote, const char *url)
ret->smart_options->receivepack = remote->receivepack;
+ ret->hash_algo = &hash_algos[GIT_HASH_SHA1];
return ret;
+const struct git_hash_algo *transport_get_hash_algo(struct transport *transport)
+ return transport->hash_algo;
int transport_set_option(struct transport *transport,
const char *name, const char *value)