diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2021-02-18 14:07:31 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-18 13:38:16 -0800 |
commit | 0ccd713cb6c4dafd36bdf85384becbb9b38504ba (patch) | |
tree | f187b54c2c7cf57fd3f65d3a1d81319ff6d6efb3 /hash.h | |
parent | midx: add num_large_offsets to write_midx_context (diff) | |
download | tgif-0ccd713cb6c4dafd36bdf85384becbb9b38504ba.tar.xz |
midx: return success/failure in chunk write methods
Historically, the chunk-writing methods in midx.c have returned the
amount of data written so the writer method could compare this with the
table of contents. This presents with some interesting issues:
1. If a chunk writing method has a bug that miscalculates the written
bytes, then we can satisfy the table of contents without actually
writing the right amount of data to the hashfile. The commit-graph
writing code checks the hashfile struct directly for a more robust
verification.
2. There is no way for a chunk writing method to gracefully fail.
Returning an int presents an opportunity to fail without a die().
3. The current pattern doesn't match chunk_write_fn type exactly, so we
cannot share code with commit-graph.c
For these reasons, convert the midx chunk writer methods to return an
'int'. Since none of them fail at the moment, they all return 0.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'hash.h')
0 files changed, 0 insertions, 0 deletions