On 12/8/2020 1:42 PM, Taylor Blau wrote: > I wonder what it would look like if we introduced a new 'struct > chunkfile' type. It would know about the underlying hashfile that it's > writing to, as well as the chunks it's supposed to write. It would > likely support three operations: add a new chunk, write the TOC, and > write the contents (the latter two could probably be combined into one). > > Below is a patch to do just that. It seems to work OK on t5319, but > fails some tests in t5318. I haven't looked into the commit-graph test > failures, but I'd be happy to do so if you think this is a direction > worth going in. I like this direction. It makes it easier to adapt future formats or add new chunks. I wonder how this write interface can adapt to the reading portion, since that is where some of the magic numbers came about. Likely there is an equivalent that we could do to have the chunk-format API construct the "struct chunkfile" and then the commit-graph and multi-pack-index parsers can interpret the chunks _after_ the TOC parse is complete. As discussed, I'm putting this series on hold for a while so generation number v2 is not interrupted. When I come back to it, I'll incorporate these design ideas and build on top of that topic. Thanks, -Stolee