Skip to main content

Module cat_file

Module cat_file 

Source
Expand description

git cat-file --batch[-check] long-running subprocess wrappers.

Both flavors keep one git subprocess alive across many queries, which is critical for scanners that need to inspect thousands of OIDs (one fork per object would dominate runtime). Send <oid>\n on stdin, parse <oid> <type> <size>\n (or <oid> missing\n) from stdout. --batch additionally streams <size> bytes of content + a trailing newline after the header.

See git-cat-file(1) § “BATCH OUTPUT”.

Structs§

BlobContent
Full response from cat-file --batch: a header plus exactly size bytes of content (only present when the header is CatFileHeader::Found).
CatFileBatch
git cat-file --batch — header + content mode. Use this once you’ve narrowed candidates with CatFileBatchCheck (typically by size).
CatFileBatchCheck
git cat-file --batch-check — header-only mode. Use this to decide whether to spend the I/O on reading a blob’s content (e.g. filter to blobs ≤ MAX_POINTER_SIZE before paying the read cost).

Enums§

CatFileHeader
One header response from cat-file --batch[-check].