On 2021-12-02 at 15:06:07, Derrick Stolee wrote: > On 11/29/2021 5:25 PM, Taylor Blau wrote: > > > +== pack-*.mtimes files have the format: > > + > > + - A 4-byte magic number '0x4d544d45' ('MTME'). > > + > > + - A 4-byte version identifier (= 1). > > + > > + - A 4-byte hash function identifier (= 1 for SHA-1, 2 for SHA-256). > > I vaguely remember complaints about using a 1-byte identifier in > the commit-graph and multi-pack-index formats because the "standard" > way to refer to these hash functions was a magic number that had a > meaning in ASCII that helped human readers a bit. I cannot find an > example of such 4-byte identifiers, but perhaps brian (CC'd) could > remind us. > > You are using a 4-byte identifier, but using the same values as > those 1-byte identifiers. The preferred value is the_hash_algo->format_id. For SHA-1, that's "sha1", big-endian (0x73686131) and for SHA-256 it's "s256", big-endian (0x73323536). There's also hash_algo_by_id to turn the format ID into an index into the hash_algos array, but you need to check for GIT_HASH_UNKNOWN (0) first. These will be used in index v3, which I haven't sent out patches for yet. -- brian m. carlson (he/him or they/them) Toronto, Ontario, CA
Attachment:
signature.asc
Description: PGP signature