Here's a v2 which fixes the reading side, as well. I think this should let you get through a full run of unpack-objects, but please confirm. :) This also includes Junio's put_be32() tweak to silence sparse. [1/5]: bswap.h: squelch potential sparse -Wcast-truncate warnings [2/5]: packfile: factor out --pack_header argument parsing [3/5]: parse_pack_header_option(): avoid unaligned memory writes [4/5]: index-pack, unpack-objects: use get_be32() for reading pack header [5/5]: index-pack, unpack-objects: use skip_prefix to avoid magic number builtin/index-pack.c | 30 ++++++++++++------------------ builtin/unpack-objects.c | 31 ++++++++++++------------------- compat/bswap.h | 24 ++++++++++++------------ pack.h | 3 ++- packfile.c | 20 ++++++++++++++++++++ packfile.h | 6 ++++++ 6 files changed, 64 insertions(+), 50 deletions(-) -Peff