Skip to content

Commit 20c4943

Browse files
ttaylorrgitster
authored andcommitted
Documentation/technical/bitmap-format.txt: add missing position table
While investigating a benign Coverity warning on the new pseudo-merge implementation, I was struggling to understand the (paraphrased) below: ofs = index_end - 24 - (index->pseudo_merges.nr * sizeof(uint64_t)); for (i = 0; i < index->pseudo_merges.nr; i++) { index->pseudo_merges.v[i].at = get_be64(ofs); ofs += sizeof(uint64_t); } , in pack-bitmap.c::load_bitmap_header(). Looking at the documentation, the diagram describing the on-disk format (prior to this patch) suggested that the optional extended lookup table immediately preceded the trailing metadata portion. If that were the case, that would make the above code from load_bitmap_header() incorrect, as we'd be blindly reading into the extended offset table. But later on in the documentation there is a description of the pseudo-merge position table as immediately preceding the trailing metadata portion of the extension. And indeed, we do write the position table in pack-bitmap-write.c: /* write positions for all pseudo merges */ for (i = 0; i < writer->pseudo_merges_nr; i++) hashwrite_be64(f, pseudo_merge_ofs[i]); hashwrite_be32(f, writer->pseudo_merges_nr); hashwrite_be32(f, kh_size(writer->pseudo_merge_commits)); hashwrite_be64(f, table_start - start); hashwrite_be64(f, hashfile_total(f) - start + sizeof(uint64_t)); So this is purely a case of the diagram being out of sync with the textual description and actual implementation of the format specification. Add the missing component back to the format diagram to avoid further confusion in this area. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0b7500d commit 20c4943

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Documentation/technical/bitmap-format.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,15 @@ the end of a `.bitmap` file. The format is as follows:
312312
| |
313313
+-------------------------------------------+
314314
| |
315+
| Pseudo-merge position table |
316+
| +----+----------+----------+----------+ |
317+
| | N | Offset 1 | .... | Offset N | |
318+
| +----+----------+----------+----------+ |
319+
| | | 8 bytes | .... | 8 bytes | |
320+
| +----+----------+----------+----------+ |
321+
| |
322+
+-------------------------------------------+
323+
| |
315324
| Pseudo-merge Metadata |
316325
| +-----------------------------------+ |
317326
| | # pseudo-merges (4 bytes) | |

0 commit comments

Comments
 (0)