On Sun, Jan 28, 2018 at 09:30:36PM +0100, Patryk Obara wrote: > On 28/01/2018 16:57, brian m. carlson wrote: > > if (partial_pack_offset == 0) { > > - unsigned char sha1[20]; > > - git_SHA1_Final(sha1, &old_sha1_ctx); > > - if (hashcmp(sha1, partial_pack_sha1) != 0) > > + unsigned char hash[GIT_MAX_RAWSZ]; > > + the_hash_algo->final_fn(hash, &old_hash_ctx); > > + if (hashcmp(hash, partial_pack_hash) != 0) > > Maybe "hash" should be struct object_id here? In this case, I opted not to do that because it's specifically not an object ID. It's a checksum for the pack, which isn't a normal Git object, so I tried to preserve that distinction. > > char *index_pack_lockfile(int ip_out) > > { > > - char packname[46]; > > + char packname[GIT_MAX_HEXSZ + 6]; > > + int len = the_hash_algo->hexsz + 6; > > Just me nitpicking, but "len" can be const :) I wanted it to be const, too, but I recall getting feedback discouraging it. I"m happy to make the change; after all, it can only help the compiler and any future readers. -- brian m. carlson / brian with sandals: Houston, Texas, US https://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: https://keybase.io/bk2204
Attachment:
signature.asc
Description: PGP signature