On Mon, Feb 24, 2020 at 03:42:59AM +0000, brian m. carlson wrote: > > Yeah, looks obviously correct (and I think this is new from the > > pack-reuse patches of mine that Christian sent recently). > > I believe it is, which is why I CC'd you on it. Heh, yeah. I knew you knew, but was saying so for the rest of the audience. :) > > I think it would also be correct to cast the mmap'd bytes to a "struct > > object_id" given that the struct contains the hash bytes as the first > > member. I worry a little that we'd get no compiler warning of the > > breakage if that assumption changes, but it also seems unlikely to do > > so. > > In the future, struct object_id will get a new member (an algorithm > value), but I think it's fine to make the assumption that the hash bytes > are first. Yeah, I think that would continue to work, although weirdness would ensue if anybody ever dereferenced the algorithm member in one of the type-punned structs. If we can avoid it entirely, I think we should (and it was easy to remove the spot in pack-check). Patches incoming. -Peff