bit_core

    Stable core facade for bit's internal Git primitives

    git
    core
    facade
    Download zip
    Author
    Version
    0.47.0
    License
    Apache-2.0
    Last updated
    13 days ago
    Downloads
    1K

    #bit_core

    Stable internal facade shared by the publishable bit modules.

    AsyncFileSystem

    Stable core facade for workspace modules.

    AsyncHttpClient

    Stable core facade for workspace modules.

    AsyncRepoFileSystem

    Stable core facade for workspace modules.

    Commit

    using @mizchi/bit_object { type Commit }

    Git commit object

    CommitInfo

    FileSystem

    Stable core facade for workspace modules.

    GitError

    Git operation errors

    HashAlgorithm

    HashState

    HttpClient

    Stable core facade for workspace modules.

    HttpResponse

    Stable core facade for workspace modules.

    MockHttpClient

    Stable core facade for workspace modules.

    ObjectId

    Object identifier (20 bytes for SHA-1, 32 bytes for SHA-256)

    ObjectStore

    ObjectType

    Git object types

    PackCompression

    Compression mode for packfile entries

    PackDeltaMode

    Delta encoding mode for packfile generation

    PackObject

    A Git object ready for packing

    RepoFileSystem

    Stable core facade for workspace modules.

    Sha1State

    Sha256State

    TestFs

    using @mizchi/bit_io { type TestFs }

    TreeEntry

    Tree entry in a Git tree object

    checkout_commit

    checkout_commit_to_fs

    Materialize commit_id under root, producing an exact checkout: paths tracked by a prior checkout that are absent from this commit are removed. rfs must observe the same filesystem as fs (callers pass the same concrete value as both trait views).

    checkout_commit_to_fs_async

    Asynchronous counterpart to checkout_commit_to_fs.

    create_blob

    fn create_blob(content : Bytes) -> (
    ObjectId
    , Bytes)

    Create a blob object from content

    create_blob_string

    fn create_blob_string(content : String) -> (
    ObjectId
    , Bytes)

    Create a blob from string content

    create_commit

    Create a commit object

    create_object

    fn create_object(obj_type :
    ObjectType
    , content : Bytes) -> (
    ObjectId
    , Bytes)

    Create a Git object and return its ID and compressed data Format: {type} {size}\0{content} -> SHA-1 -> zlib compress

    create_tree

    Create a tree object from entries Entries must be sorted by name

    hash_array_prefix

    fn hash_array_prefix(data : Array[Byte], len : Int, hash_size? : Int) ->
    ObjectId

    Hash Array prefix (first len bytes), dispatching by hash_size.

    hash_blob

    fn hash_blob(content : Bytes) ->
    ObjectId

    Hash a blob without creating the compressed object - optimized with incremental SHA1

    hash_blob_string

    fn hash_blob_string(content : String) ->
    ObjectId

    Hash a blob from string - optimized with incremental SHA1

    hash_object_content

    fn hash_object_content(obj_type :
    ObjectType
    , content : Bytes) ->
    ObjectId

    Hash object content (without compression) - optimized with incremental SHA1

    hash_object_content_with_algo

    Hash object content using the specified algorithm.

    hash_prefix

    fn hash_prefix(data : Bytes, len : Int, hash_size? : Int) ->
    ObjectId

    Hash data prefix (first len bytes), dispatching by hash_size.

    join_path

    fn join_path(root : String, path : String) -> String

    materialize_clone_to_fs

    fn materialize_clone_to_fs(store :
    ObjectStore
    , commit_id :
    ObjectId
    , refname : String, remote_url : String, fs : &
    FileSystem
    , root : String, rfs : &
    RepoFileSystem
    ) -> Unit raise
    GitError

    materialize_clone_to_fs_async

    async fn[FS :
    AsyncFileSystem
    +
    AsyncRepoFileSystem
    ] materialize_clone_to_fs_async(store :
    ObjectStore
    , commit_id :
    ObjectId
    , refname : String, remote_url : String, fs : FS, root : String) -> Unit raise
    GitError

    Asynchronous counterpart to materialize_clone_to_fs.

    parse_commit

    serialize_commit_content

    fn serialize_commit_content(commit :
    Commit
    ) -> Bytes

    Serialize commit to raw content bytes (without git object header)

    serialize_tree

    fn serialize_tree(entries : Array[
    TreeEntry
    ]) -> Bytes

    Serialize tree entries to raw content bytes (without git object header)

    sha1

    fn sha1(data : Bytes) ->
    ObjectId

    Compute SHA-1 hash of data

    sha1_array

    fn sha1_array(data : Array[Byte]) ->
    ObjectId

    Compute SHA-1 hash of data from Array

    sha1_array_prefix

    fn sha1_array_prefix(data : Array[Byte], len : Int) ->
    ObjectId

    Compute SHA-1 hash of Array prefix (first len bytes).

    sha1_prefix

    fn sha1_prefix(data : Bytes, len : Int) ->
    ObjectId

    Compute SHA-1 hash of data prefix (first len bytes).

    sha256_array_prefix

    fn sha256_array_prefix(data : Array[Byte], len : Int) ->
    ObjectId

    sha256_prefix

    fn sha256_prefix(data : Bytes, len : Int) ->
    ObjectId

    verify_tree_entry_name

    fn verify_tree_entry_name(name : String) -> Unit raise
    GitError

    Verify a single tree-entry name is safe to materialize into a worktree path.

    Rejects: empty string, ., .., any name containing / or NUL, and .git case-insensitively (the canonical foothold for hooks, config, refs). Mirrors the subset of git's verify_path() that matters for path-traversal during checkout / clone / fetch.

    Called at the bytes→worktree boundary (walk_tree_to_fs, lib.collect_tree_files_inner). Reading the bytes via @object.parse_tree is unaffected: a repo might still contain legacy commits with names we now reject, but bit refuses to materialize them. Use git fsck --strict upstream to catch the commit; bit will not silently write into .git/ or above the worktree.

    write_git_metadata

    fn write_git_metadata(store :
    ObjectStore
    , commit_id :
    ObjectId
    , refname : String, remote_url : String, fs : &
    FileSystem
    , root : String, rfs : &
    RepoFileSystem
    ) -> Unit raise
    GitError

    write_git_metadata_async

    async fn[FS :
    AsyncFileSystem
    +
    AsyncRepoFileSystem
    ] write_git_metadata_async(store :
    ObjectStore
    , commit_id :
    ObjectId
    , refname : String, remote_url : String, fs : FS, root : String) -> Unit raise
    GitError

    Asynchronous counterpart to write_git_metadata.

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io