Skip to main content

Module midx

Module midx 

Source
Expand description

Multi-pack-index (MIDX) read and write.

Structs§

MidxBtmpPackRange
One pack’s slice of the MIDX pseudo-bitmap namespace (BTMP chunk).
MidxObjectRef
A single MIDX-referenced object together with the pack it is attributed to.
MidxReuseTables
OID rows from the active multi-pack-index, plus reverse-index order for pack-reuse bitmap bits.
WriteMultiPackIndexOptions
Options for writing a multi-pack index (extension of the simple writer).
WriteMultiPackIndexResult
Result of write_multi_pack_index_with_options.

Enums§

CompactError
Failure modes of compact_multi_pack_index, each mapping to one of git’s user-facing diagnostics in cmd_multi_pack_index_compact.
MidxBitmapWriteOutcome
Outcome of an optional MIDX reachability bitmap write.

Functions§

cached_tip_midx_path
Whether a tip MIDX file exists under pack_dir (live filesystem probe).
clear_pack_midx_state
Build objects/pack/multi-pack-index for all pack indexes in pack_dir.
compact_multi_pack_index
git multi-pack-index compact <from> <to>: merge the inclusive chain range [from..to] (oldest→newest, matching git’s from=argv[0] / to=argv[1]) into a single new incremental layer, preserving pack order, and rewrite the chain as [layers before from] + [compacted layer] + [layers after to].
evict_midx_read_cache_for_pack_dir
Drop cached MIDX bytes and tip resolution after pack-directory changes.
format_midx_bitmapped_packs
Format test-tool read-midx --bitmap output for the active MIDX: per pack, a line with <pack>.pack, then bitmap_pos: and bitmap_nr:. Returns an error whose message is MIDX does not contain the BTMP chunk when the MIDX has no BTMP chunk (mirrors nth_bitmapped_pack in git/midx.c).
format_midx_dump
format_midx_dump function.
format_midx_dump_layer
Like format_midx_dump but reads a specific layer by checksum (chain layer or root MIDX). Used by test-tool read-midx <object-dir> <checksum>.
format_midx_show_objects
Human-readable dump of the MIDX (matches test-tool read-midx layout closely enough for grep-based tests). Emit one line per MIDX object: {oid} {offset}\t{pack-idx-name} (matches Git test-read-midx.c).
format_midx_show_objects_layer
Like format_midx_show_objects but reads a specific layer by checksum.
load_midx_reuse_tables
Load OID / object-offset / reverse-index tables from the tip MIDX (root or chain tip).
load_midx_reuse_tables_from_path
Load reuse tables from one on-disk MIDX layer (multi-pack-index or multi-pack-index.d/…midx).
midx_checksum_hex
Trailing 40-character SHA-1 hex of the active MIDX (root or chain tip).
midx_lookup_pack_and_offset
Look up which pack and in-pack offset holds oid according to the active MIDX.
midx_lookup_pack_and_offset_opt
Look up which pack and in-pack offset holds oid when listed in the active MIDX.
midx_oid_listed_in_tip
Returns whether oid appears in the active MIDX OID table for objects_dir.
midx_sidecar_path_for_midx_file
Resolve a specific MIDX layer file by its lowercase hex checksum. Searches the incremental chain (multi-pack-index.d/multi-pack-index-<hash>.midx) and the single-file root MIDX. Returns None when no layer matches that checksum. Sidecar path multi-pack-index-<hash>.<ext> in the same directory as midx_path.
read_midx_btmp_ranges
Read per-pack (bitmap_pos, bitmap_nr) from the active MIDX BTMP chunk.
read_midx_objects
Read the tip MIDX and return (pack_names, objects), where each object names the pack it is attributed to (pack_int_id). Mirrors the per-object nth_midxed_pack_int_id iteration in Git used by expire/repack.
read_midx_pack_idx_names
Pack index basenames stored in the active tip MIDX’s pack-names chunk.
read_midx_preferred_idx_name
read_midx_preferred_idx_name function.
resolve_midx_bitmap_layer
Newest chain layer (or root MIDX) that has a non-empty .bitmap sidecar beside its MIDX file.
resolve_midx_layer_path
resolve_midx_layer_path function.
resolve_tip_midx_path
resolve_tip_midx_path function.
try_read_info_via_midx
Like try_read_object_via_midx, but returns ObjectInfo without inflating object bodies.
try_read_info_via_midx_with_diagnostics
Like try_read_info_via_midx, emitting recoverable MIDX warnings through diagnostics.
try_read_object_via_midx
When core.multiPackIndex is enabled, try to read oid from the active MIDX in objects_dir.
try_read_object_via_midx_with_diagnostics
Like try_read_object_via_midx, emitting recoverable MIDX warnings through diagnostics.
validate_midx_referenced_packs
Validate existing pack indexes named by the active MIDX once per prepared chain view.
validate_midx_referenced_packs_with_diagnostics
Like validate_midx_referenced_packs, emitting warnings through diagnostics.
verify_midx
Full multi-pack-index verification, mirroring verify_midx_file in git/midx.c plus the die()/error() conditions in load_multi_pack_index. On any problem returns the list of error lines (without error:/fatal: prefixes) in the order Git emits them; an empty list means the MIDX is valid.
write_multi_pack_index
write_multi_pack_index function.
write_multi_pack_index_with_options
Write multi-pack-index with optional preferred pack, bitmap sidecars, and incremental chain.