connected: switch GIT_SHA1_HEXSZ to the_hash_algo

Switch various uses of GIT_SHA1_HEXSZ to reference the_hash_algo instead. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Aug 18, 2019 at 20:04 UTC 9d958cc0417ce2c8a4504ac8dd140685445ce4d7
1 file changed +4 -3
connected.c
+4 -3
@@ -28,6 +28,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
28 struct packed_git *new_pack = NULL;
29 struct transport *transport;
30 size_t base_len;
31 + const unsigned hexsz = the_hash_algo->hexsz;
32
33 if (!opt)
34 opt = &defaults;
@@ -99,7 +100,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
100
101 sigchain_push(SIGPIPE, SIG_IGN);
102
102 - commit[GIT_SHA1_HEXSZ] = '\n';
103 + commit[hexsz] = '\n';
104 do {
105 /*
106 * If index-pack already checked that:
@@ -112,8 +113,8 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
113 if (new_pack && find_pack_entry_one(oid.hash, new_pack))
114 continue;
115
115 - memcpy(commit, oid_to_hex(&oid), GIT_SHA1_HEXSZ);
116 - if (write_in_full(rev_list.in, commit, GIT_SHA1_HEXSZ + 1) < 0) {
116 + memcpy(commit, oid_to_hex(&oid), hexsz);
117 + if (write_in_full(rev_list.in, commit, hexsz + 1) < 0) {
118 if (errno != EPIPE && errno != EINVAL)
119 error_errno(_("failed write to rev-list"));
120 err = -1;