X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=connected.c;h=36c4e5dedb6a7bc76e29bc5e9f8f44f12b7c7057;hb=020011f2cb9873dccaad71f6ecbe56d0eac530e2;hp=971db009b327e63cf71c82b496d70604cecf6415;hpb=3f84633563f34e069876106fbe64980a6e1c15c0;p=thirdparty%2Fgit.git diff --git a/connected.c b/connected.c index 971db009b3..36c4e5dedb 100644 --- a/connected.c +++ b/connected.c @@ -29,6 +29,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data, struct packed_git *new_pack = NULL; struct transport *transport; size_t base_len; + const unsigned hexsz = the_hash_algo->hexsz; if (!opt) opt = &defaults; @@ -100,7 +101,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data, sigchain_push(SIGPIPE, SIG_IGN); - commit[GIT_SHA1_HEXSZ] = '\n'; + commit[hexsz] = '\n'; do { /* * If index-pack already checked that: @@ -113,8 +114,8 @@ int check_connected(oid_iterate_fn fn, void *cb_data, if (new_pack && find_pack_entry_one(oid.hash, new_pack)) continue; - memcpy(commit, oid_to_hex(&oid), GIT_SHA1_HEXSZ); - if (write_in_full(rev_list.in, commit, GIT_SHA1_HEXSZ + 1) < 0) { + memcpy(commit, oid_to_hex(&oid), hexsz); + if (write_in_full(rev_list.in, commit, hexsz + 1) < 0) { if (errno != EPIPE && errno != EINVAL) error_errno(_("failed write to rev-list")); err = -1;