On Sun, Jan 28, 2018 at 10:57 AM, brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx> wrote: > Convert various uses of direct calls to SHA-1 and 20- and 40-based > constants to use the_hash_algo instead. Don't yet convert the on-disk > data structures, which will be handled in a future commit. > > Signed-off-by: brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx> > --- > diff --git a/read-cache.c b/read-cache.c > @@ -2000,26 +2000,26 @@ static int write_index_ext_header(git_SHA_CTX *context, int fd, > /* Flush first if not enough space for SHA1 signature */ Did you want to update the comment to remove the SHA1 reference also? (Or was the omission intentional per the commit message?) > - if (left + 20 > WRITE_BUFFER_SIZE) { > + if (left + the_hash_algo->rawsz > WRITE_BUFFER_SIZE) { > if (write_in_full(fd, write_buffer, left) < 0) > return -1; > left = 0; > } > > /* Append the SHA1 signature at the end */ Ditto. > - git_SHA1_Final(write_buffer + left, context); > - hashcpy(sha1, write_buffer + left); > - left += 20; > + the_hash_algo->final_fn(write_buffer + left, context); > + hashcpy(hash, write_buffer + left); > + left += the_hash_algo->rawsz;