Skip to content

Latest commit

 

History

History
288 lines (187 loc) · 8.62 KB

File-src-git-objects-ml-412526168.md

File metadata and controls

288 lines (187 loc) · 8.62 KB

src/git/objects.ml

Home · Files

Read and write Git loose objects and version-two packed objects.

Package: git.objects

Reachable from entry: yes

Imports

  • atomic.ml as atomic → src/git/atomic.ml
  • deflate.ml as deflate → src/git/deflate.ml
  • hash.ml as hash → src/git/hash.ml
  • std/bytes.ml as by → ../release_1_3_17_ml/std/bytes.ml — external dependency
  • std/crypto.ml as crypto → ../release_1_3_17_ml/std/crypto.ml — external dependency
  • std/fs.ml as fs → ../release_1_3_17_ml/std/fs.ml — external dependency
  • std/string.ml as s → ../release_1_3_17_ml/std/string.ml — external dependency

Declarations

applyDelta

function applyDelta(base, delta)

Apply Git's copy/insert delta program to a base object.

Parameter Type Default Description
base dynamic — Uncompressed base object bytes.
delta dynamic — Uncompressed delta instruction bytes.

View source

compareOid

function compareOid(index, offset, target)

Compare a pack-index object name to an OID without allocating a slice.

Parameter Type Default Description
index dynamic — Index bytes.
offset dynamic — OID byte offset.
target dynamic — Requested object ID bytes.

View source

deltaVarint

function deltaVarint(data, cursor)

Read a Git variable-length integer in delta instruction bytes.

Parameter Type Default Description
data dynamic — Delta bytes.
cursor dynamic — One-element mutable byte position.

View source

equalRange

function equalRange(source, offset, target)

Return an exact bytewise comparison for a range in a buffer.

Parameter Type Default Description
source dynamic — Source bytes.
offset dynamic — Start offset.
target dynamic — Expected bytes.

View source

loosePath

function loosePath(repo, oid)

Return the object path in a Git object database.

Parameter Type Default Description
repo dynamic — Open repository.
oid dynamic — Lowercase hex object ID.

View source

MAX_OBJECT

const MAX_OBJECT = 268435456

Largest decoded object accepted by the IDE.

View source

OBJECT_ERR

const OBJECT_ERR = 9403

Object-store error code.

View source

objectError

function objectError(message)

Build an error describing an unsupported or malformed object.

Parameter Type Default Description
message dynamic — Diagnostic text.

View source

packOffset

function packOffset(index, target)

Find the byte offset of an object in a version-two pack index.

Parameter Type Default Description
index dynamic — Complete .idx bytes.
target dynamic — Requested OID bytes.

View source

parseCanonical

function parseCanonical(canonical)

Parse a loose Git object after zlib inflation.

Parameter Type Default Description
canonical dynamic — Object header and body.

View source

read

function read(repo, oid, depth = 0)

Read an object by ID from loose storage or a packed archive.

Parameter Type Default Description
repo dynamic — Open repository.
oid dynamic — Lowercase hex object ID.
depth dynamic 0 Maximum recursion guard for reference deltas.

View source

readLoose

function readLoose(repo, oid)

Read and verify a loose object.

Parameter Type Default Description
repo dynamic — Open repository.
oid dynamic — Object ID.

View source

readPacked

function readPacked(repo, oid)

Find an object in available version-two pack indexes.

Parameter Type Default Description
repo dynamic — Open repository.
oid dynamic — Requested hex object ID.

View source

readPackEntry

function readPackEntry(repo, pack, offset, depth)

Decode an entry in a Git pack, resolving offset and reference deltas.

Parameter Type Default Description
repo dynamic — Open repository.
pack dynamic — Complete .pack bytes.
offset dynamic — Entry byte offset.
depth dynamic — Maximum recursion guard.

View source

readU64

function readU64(data, offset)

Read a big-endian unsigned 64-bit offset.

Parameter Type Default Description
data dynamic — Source bytes.
offset dynamic — First byte.

View source

write

function write(repo, kind, data)

Write a canonical object as a new loose Git object.

Parameter Type Default Description
repo dynamic — Open repository.
kind dynamic — Object type.
data dynamic — Uncompressed body.

View source