Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-git

Source of release 0.5.1

0.5.1 / src / git.lucb

import object
import packet
import loose
import interop
import tree
import delta
import pack
import pack_writer
import refs
import commit
import tag
import push
import fetch

pub type FetchRequest = fetch.Request

pub func decode_fetch(input: const u8[]) -> FetchRequest!:
    return try fetch.decode(input)

pub type PushRequest = push.Request
pub type PushCommand = push.Command

pub func decode_push(input: const u8[]) -> PushRequest!:
    return try push.decode(input)

pub type Tag = tag.Tag

pub func decode_tag(input: const u8[]) -> Tag!:
    return try tag.decode(input)

pub type Commit = commit.Commit

pub func decode_commit(input: const u8[]) -> Commit!:
    return try commit.decode(input)

pub func decode_id(text: str, output: u8[]) -> !:
    try commit.decode_id(text, output)

pub func valid_ref(name: str) -> bool:
    return refs.valid(name)

pub func encode_pack(objects: const Object[], output: u8[]) -> usize!:
    return try pack_writer.encode(objects, output)

pub type Pack = pack.Pack
pub type PackItem = pack.Item
pub type PackLookup = pack.Lookup

pub func decode_pack(input: const u8[]) -> Pack!:
    return try pack.decode(input)

## Decode a thin pack with bounded, SHA-1-verified borrowed base lookup.
pub func decode_pack_with(input: const u8[], lookup: PackLookup, context: void*?) -> Pack!:
    return try pack.decode(input, lookup, context)

pub func apply_delta(base: const u8[], instructions: const u8[], output: u8[]) -> usize!:
    return try delta.apply(base, instructions, output)

pub type TreeEntry = tree.Entry

pub func decode_tree_entry(input: const u8[]) -> TreeEntry!:
    return try tree.decode(input)

pub func encode_tree_entry(entry: TreeEntry, output: u8[]) -> usize!:
    return try tree.encode(entry, output)

pub func validate_tree(input: const u8[]) -> usize!:
    return try tree.validate(input)

pub type CompressedObject = loose.Compressed

pub func encode_loose(kind: str, payload: const u8[], max_output: i64 = 67108864) -> interop.Reference[CompressedObject]!:
    return try loose.encode(kind, payload, max_output)

pub func decode_loose(input: const u8[], expected_id: const u8[], output: u8[]) -> Object!:
    return try loose.decode(input, expected_id, output)

pub type Packet = packet.Packet
pub type PacketKind = packet.Kind

pub func decode_packet(input: const u8[]) -> Packet!:
    return try packet.decode(input)

pub func encode_packet(kind: PacketKind, payload: const u8[], output: u8[]) -> usize!:
    return try packet.encode(kind, payload, output)

pub let invalid = object.invalid
pub type Object = object.Object

pub func encode_object(kind: str, payload: const u8[], out: u8[]) -> usize!:
    return try object.encode(kind, payload, out)

pub func decode_object(input: const u8[]) -> Object!:
    return try object.decode(input)

pub func hash_object(kind: str, payload: const u8[], out: u8[]) -> usize!:
    return try object.hash_object(kind, payload, out)

pub func hash_blob(payload: const u8[], out: u8[]) -> usize!:
    return try object.hash_blob(payload, out)

pub func hex_id(id: const u8[], out: u8[]) -> usize!:
    return try object.hex_id(id, out)