diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2020-06-05 13:00:30 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-06-08 12:28:49 -0700 |
commit | 5cfa438a76f7f67f34f6f758b62943261ded1fb5 (patch) | |
tree | 71522f20164715f850153d741cadaaebc7f5c4b3 /compat | |
parent | commit-graph: simplify parse_commit_graph() #1 (diff) | |
download | tgif-5cfa438a76f7f67f34f6f758b62943261ded1fb5.tar.xz |
commit-graph: simplify parse_commit_graph() #2
The Chunk Lookup table stores the chunks' starting offset in the
commit-graph file, not their sizes. Consequently, the size of a chunk
can only be calculated by subtracting its offset from the offset of
the subsequent chunk (or that of the terminating label). This is
currenly implemented in a bit complicated way: as we iterate over the
entries of the Chunk Lookup table, we check the id of each chunk and
store its starting offset, then we check the id of the last seen chunk
and calculate its size using its previously saved offset. At the
moment there is only one chunk for which we calculate its size, but
this patch series will add more, and the repeated chunk id checks are
not that pretty.
Instead let's read ahead the offset of the next chunk on each
iteration, so we can calculate the size of each chunk right away,
right where we store its starting offset.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
0 files changed, 0 insertions, 0 deletions