Skip to content

Commit e9977b1

Browse files
Abhra303ttaylorr
authored andcommitted
Documentation/technical: describe bitmap lookup table extension
When reading bitmap file, Git loads each and every bitmap one by one even if all the bitmaps are not required. A "bitmap lookup table" extension to the bitmap format can reduce the overhead of loading bitmaps which stores a list of bitmapped commit id pos (in the midx or pack, along with their offset and xor offset. This way Git can load only the necessary bitmaps without loading the previous bitmaps. Older versions of Git ignore the lookup table extension and don't throw any kind of warning or error while parsing the bitmap file. Add some information for the new "bitmap lookup table" extension in the bitmap-format documentation. Mentored-by: Taylor Blau <[email protected]> Co-Mentored-by: Kaartic Sivaraam <[email protected]> Co-Authored-by: Taylor Blau <[email protected]> Signed-off-by: Abhradeep Chakraborty <[email protected]> Reviewed-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent afa7014 commit e9977b1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Documentation/technical/bitmap-format.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ MIDXs, both the bit-cache and rev-cache extensions are required.
7272
pack/MIDX. The format and meaning of the name-hash is
7373
described below.
7474

75+
** {empty}
76+
BITMAP_OPT_LOOKUP_TABLE (0x10): :::
77+
If present, the end of the bitmap file contains a table
78+
containing a list of `N` <commit_pos, offset, xor_row>
79+
triplets. The format and meaning of the table is described
80+
below.
81+
+
82+
NOTE: Unlike the xor_offset used to compress an individual bitmap,
83+
`xor_row` stores an *absolute* index into the lookup table, not a location
84+
relative to the current entry.
85+
7586
4-byte entry count (network byte order): ::
7687
The total count of entries (bitmapped commits) in this bitmap index.
7788

@@ -216,3 +227,31 @@ Note that this hashing scheme is tied to the BITMAP_OPT_HASH_CACHE flag.
216227
If implementations want to choose a different hashing scheme, they are
217228
free to do so, but MUST allocate a new header flag (because comparing
218229
hashes made under two different schemes would be pointless).
230+
231+
Commit lookup table
232+
-------------------
233+
234+
If the BITMAP_OPT_LOOKUP_TABLE flag is set, the last `N * (4 + 8 + 4)`
235+
bytes (preceding the name-hash cache and trailing hash) of the `.bitmap`
236+
file contains a lookup table specifying the information needed to get
237+
the desired bitmap from the entries without parsing previous unnecessary
238+
bitmaps.
239+
240+
For a `.bitmap` containing `nr_entries` reachability bitmaps, the table
241+
contains a list of `nr_entries` <commit_pos, offset, xor_row> triplets
242+
(sorted in the ascending order of `commit_pos`). The content of i'th
243+
triplet is -
244+
245+
* {empty}
246+
commit_pos (4 byte integer, network byte order): ::
247+
It stores the object position of a commit (in the midx or pack
248+
index).
249+
250+
* {empty}
251+
offset (8 byte integer, network byte order): ::
252+
The offset from which that commit's bitmap can be read.
253+
254+
* {empty}
255+
xor_row (4 byte integer, network byte order): ::
256+
The position of the triplet whose bitmap is used to compress
257+
this one, or `0xffffffff` if no such bitmap exists.

0 commit comments

Comments
 (0)