The change being presented is sort of special in that we need all its hunks plus contents. But it was placed in the changestore along with all the other changes, and that storage might get realloc()'ed because new changes need to be loaded. This would render any pointers into the contents of the changestore invalid, which will happen for the hunks being inspected.
A better overhaul is probably needed (something sans-io like), but for now we move the first change, the change that the user wants to get printed, out of the changestore and manage it separately. It is the only change where we need to look at its hunks. '
PYNIQ644Z3Y3ADNE642GCJUJLUQRYZKHZ7ERKVDVLRTBPZPHQWMQC
SMB3M6ESOIR2LMFII2VFQJSPFIUYXHD7CXYARIGOKPB2QF2ORFLAC
XDWQHPFDPJFZLSS5HL6FVH2XCTLC33ATWAG7VY4MDOXNFL5ZXNTAC
72V7NBNWF4EQ4Z7NRBVTUCAI3CFM54HVF4RCS4ZAY75UQBZZT7CQC
5D2IYPL75HEP6JUEILEADSZRRSV72NECT6UQR3PORNDR35I2P5GQC
Q7TKZCJP2Z75EICZYKCEZDHKGERSOKZGMTSU3UXETBHTF663T66AC
EHVLRMEF6YK5FRIV5V7V6P5RHJPCYKMSW5OVKDXLUEWHEM624FBAC
RRYWNHFE3EIRQYBGMSZRLDGKWHVMDAO42QNKFQ2KVYPDC4IHANTAC
ZS3UJEZU4PZEYOXQNZWZGDNXTP5ESNPRAEHPJQ24O3TWZH746IBQC
QSQNGA5KZ4BVWE4FUJUMOP6SJRIXAC2PYU6JSRG5KXWLYWZZMAJQC
ZTDGWUGPKDVIUA6V5BZ5ATDTGKZEE6ZZIXLGNTUJU2KIV7H7YSVQC
P5CSMRVSVJVOUGGWY7UVP4B3XXNLZDEQVXNL5XOPT2GGB63HXA4QC
struct changeentry *ch;
usize x;
changestoreinit(&changestore, 4, repo->path);
ch = &changestore.entries[0];
struct change c = { 0 };
struct hash h = { 0 };