bit_lib

Porcelain (gix-equivalent): high-level Git operations facade

git
porcelain
moon add mizchi/bit_lib@0.46.4
Download zip
Author
Version
0.46.4
License
Apache-2.0
Last updated
4 days ago
Downloads
494
README

#
Clock

pub(open) trait Clock {
fn now(Self) -> Int64
}

#
Random

pub(open) trait Random {
fn short(Self) -> String
}

#
RefStore

pub(open) trait RefStore {
fn resolve(Self, String) ->
ObjectId
? raise
GitError

fn update(Self, String,
ObjectId
?) -> Unit raise
GitError

fn list(Self, String) -> Array[String] raise
GitError

}

#
Transport

pub(open) trait Transport {
fn fetch(Self, String, Array[
ObjectId
]) -> Bytes raise
GitError

fn push(Self, String, Array[PushUpdate]) -> Result[Unit, String] raise
GitError

}

#
WorkingTree

pub(open) trait WorkingTree {
fn read_file(Self, String) -> Bytes raise
GitError

fn write_file(Self, String, Bytes) -> Unit
fn remove_file(Self, String) -> Unit
fn is_file(Self, String) -> Bool
fn is_dir(Self, String) -> Bool
fn readdir(Self, String) -> Array[String] raise
GitError

fn is_dirty(Self) -> Bool
fn rollback(Self) -> Unit
fn get_working_files(Self) -> Array[String]
fn snapshot(Self, String, String, Int64) ->
ObjectId
raise
GitError

fn checkout(Self,
ObjectId
) -> Unit raise
GitError

}

#
AutoCrlf

pub enum AutoCrlf {
Off
Input
On
}

#
BranchConfig

pub(all) struct BranchConfig {
name : String
remote : String?
merges : Array[String]
rebase : Bool?
}

#
BranchInfo

pub struct BranchInfo {
name : String
id :
ObjectId

current : Bool
}

#
CherryPickResult

pub struct CherryPickResult {
status : CherryPickStatus
commit_id :
ObjectId
?
conflicts : Array[String]
}

#
CherryPickStatus

pub enum CherryPickStatus {
Success
Conflict
}

#
CommitGraphCommitInfo

pub(all) struct CommitGraphCommitInfo {
tree :
ObjectId

parents : Array[
ObjectId
]
committer_timestamp : Int64
}

#
CommitGraphFile

pub struct CommitGraphFile {
data : Bytes
hash_size : Int
num_commits : Int
oidf_offset : Int
oidl_offset : Int
cdat_offset : Int
edge_offset : Int
}

#
CommitGraphFile::find_commit

Look up a commit OID in the graph. Returns its position index or -1.

#
CommitGraphFile::get_oid

Get the OID at position pos in the OID lookup table.

#
CommitGraphFile::read_commit

Read commit data at position pos. Returns (tree_oid, parent_ids, timestamp).

#
CommitGraphFile::read_commit_info

fn CommitGraphFile::read_commit_info(self : CommitGraphFile, pos : Int) -> CommitGraphCommitInfo

#
CommitGraphFile::synthesize_commit_object

Synthesize a commit object from graph data (for fallback when loose/packed missing).

#
ConfigBlock

pub(all) struct ConfigBlock {
header : String?
section : String?
name : String?
lines : Array[String]
}

#
DiffFile

pub struct DiffFile {
path : String
kind : DiffKind
old_content : Bytes?
new_content : Bytes?
old_mode : Int?
new_mode : Int?
}

#
DiffKind

pub enum DiffKind {
Added
Modified
Deleted
}

#
EolAttr

pub enum EolAttr {
Lf
Crlf
Unspecified
}

#
FetchRefspec

pub(all) struct FetchRefspec {
negative : Bool
src : String
dst : String
}

#
FileEolAttrs

pub struct FileEolAttrs {
text : TextAttr
eol : EolAttr
filter : String?
}

#
FilterCmd

pub(all) struct FilterCmd {
run : async (String, String, String, Bytes) -> Bytes raise
GitError

}

#
FsckResult

pub struct FsckResult {
errors : Int
reachable : Map[String, Bool]
missing : Map[String, Bool]
root_commits : Array[String]
tag_objects : Array[String]
}

#
GcResult

pub struct GcResult {
pack : RepackResult?
dangling : Array[
ObjectId
]
}

#
GitHubShorthand

pub(all) enum GitHubShorthand {
Repo(String, String?)
Subdir(String, String, String?)
File(String, String)
} derive(Eq,
Debug
)

#
HeadRef

pub enum HeadRef {
Branch(String)
Detached(
ObjectId
)
}

#
HistoryEmptyAction

pub(all) enum HistoryEmptyAction {
Drop
Keep
Abort
} derive(Eq)

#
HistoryFixupResult

pub(all) struct HistoryFixupResult {
updates : Array[HistoryRefUpdate]
rewritten :
ObjectId
?
}

#
HistoryRefUpdate

pub(all) struct HistoryRefUpdate {
refname : String
old_id :
ObjectId

new_id :
ObjectId

} derive(Eq)

#
HttpResponse

pub struct HttpResponse {
status : Int
headers : Map[String, String]
body : Bytes
}

#
IndexEntry

pub struct IndexEntry {
path : String
id :
ObjectId

mode : Int
size : Int
mtime_sec : Int
mtime_nsec : Int
intent_to_add : Bool
dev : Int
ino : Int
uid : Int
gid : Int
}

#
IndexEntry::new

fn IndexEntry::new(path : String, id :
ObjectId
, mode : Int, size : Int, mtime_sec? : Int, mtime_nsec? : Int, intent_to_add? : Bool, dev? : Int, ino? : Int, uid? : Int, gid? : Int) -> IndexEntry

#
IndexStageEntry

pub struct IndexStageEntry {
entry : IndexEntry
stage : Int
}

#
IndexStageEntry::new

fn IndexStageEntry::new(entry : IndexEntry, stage : Int) -> IndexStageEntry

#
InitOptions

pub(all) struct InitOptions {
default_branch : String
bare : Bool
separate_git_dir : String?
template_dir : String?
ref_format : String
object_format : String
is_reinit : Bool
git_dir : String?
work_tree : String?
shared : String?
}

#
InitOptions::new

#
InteractiveRebaseResult

pub struct InteractiveRebaseResult {
status : InteractiveRebaseStatus
commit_id :
ObjectId
?
message : String
exit_code : Int
}

#
InteractiveRebaseState

pub struct InteractiveRebaseState {
onto :
ObjectId

orig_head :
ObjectId

head_name : String
todo : Array[InteractiveTodoEntry]
done : Array[InteractiveTodoEntry]
amend : Bool
squash_msg : String
update_refs : Map[String, String]
commit_map : Map[String, String]
labels : Map[String, String]
}

#
InteractiveRebaseStatus

pub enum InteractiveRebaseStatus {
IRBComplete
IRBConflict
IRBStopped
IRBAborted
}

#
InteractiveTodoEntry

pub struct InteractiveTodoEntry {
command : TodoCommand
commit_hex : String
subject : String
} derive(Eq,
Debug
)

#
LazyPackIndex

pub struct LazyPackIndex {
idx_path : String
pack_path : String
loaded : PackIndex?
}

Lazy pack index - loads index data on first access

#
LazyPackIndex::find_offset_hex

#
LazyPackIndex::new

fn LazyPackIndex::new(idx_path : String, pack_path : String) -> LazyPackIndex

#
LfsPointer

pub struct LfsPointer {
oid : String
size : Int64
} derive(Eq,
Debug
)

#
LmCommit

#
LmPath

pub(all) struct LmPath {
path : String
}

#
LmResult

pub(all) struct LmResult {
oid :
ObjectId

path : String
boundary : Bool
}

#
LogEntry

pub struct LogEntry {
id :
ObjectId

message : String
body_lines : Array[String]
author : String
timestamp : Int64
date_tz : String
tree :
ObjectId

parent_tree :
ObjectId
?
}

#
MergeResult

pub struct MergeResult {
status : MergeStatus
commit_id :
ObjectId
?
conflicts : Array[String]
conflict_types : Map[String, String]
}

#
MergeStatus

pub enum MergeStatus {
AlreadyUpToDate
FastForward
Merged
Conflicted
}

#
ObjectDb

pub struct ObjectDb {
objects_dir : String
loose_paths : Map[String, String]
packs : Array[PackIndex]
lazy_packs : Array[LazyPackIndex]
pack_cache : Map[String, Bytes]
pack_cache_order : Array[String]
pack_cache_limit : Int
decoded_cache : Map[String,
PackObject
]
decoded_cache_order : Array[String]
decoded_cache_bytes : Int
decoded_cache_limit : Int
prefer_packed : Bool
saw_corrupt_pack : Bool
skip_verify : Bool
commit_graph : CommitGraphFile?
}

#
ObjectDb::disable_commit_graph

fn ObjectDb::disable_commit_graph(self : ObjectDb) -> Unit

#
ObjectDb::enable_commit_graph

fn ObjectDb::enable_commit_graph(self : ObjectDb, rfs : &
RepoFileSystem
, git_dir : String) -> Unit

#
ObjectDb::find_delta_base

Return delta base object id if the selected packed object is DELTA. Returns None for loose objects or non-delta packed objects.

#
ObjectDb::find_object_disk_size

Return object size on disk.
  • loose object: compressed loose file size
  • packed object: packed entry byte length

#
ObjectDb::get_commit_graph_commit

fn ObjectDb::get_commit_graph_commit(self : ObjectDb, id :
ObjectId
) -> CommitGraphCommitInfo?

#
ObjectDb::load

Load ObjectDb with full loose object scan (slower but complete)

#
ObjectDb::load_from_objects_dir

fn ObjectDb::load_from_objects_dir(fs : &
RepoFileSystem
, objects_dir : String) -> ObjectDb raise
GitError

#
ObjectDb::load_lazy

Load ObjectDb lazily - don't scan loose objects or load pack indexes upfront

#
ObjectDb::load_lazy_from_objects_dir

fn ObjectDb::load_lazy_from_objects_dir(fs : &
RepoFileSystem
, objects_dir : String) -> ObjectDb raise
GitError

#
ObjectDb::set_prefer_packed

fn ObjectDb::set_prefer_packed(self : ObjectDb, value : Bool) -> Unit

#
ObjectDb::set_skip_verify

fn ObjectDb::set_skip_verify(self : ObjectDb, value : Bool) -> Unit

#
PackIndex

pub struct PackIndex {
pack_path : String
id_bytes : Bytes
hash_size : Int
offsets : Array[Int64]
version : Int
hex_ids_cache : Array[String]?
offset_index_cache : Map[Int64, Int]?
sorted_offsets_cache : Array[Int64]?
}

#
PackIndex::find_id_by_offset

fn PackIndex::find_id_by_offset(self : PackIndex, offset : Int64) -> String?

Find object id (hex) by offset, via the lazily-built offset->index map.

#
PackIndex::find_offset

fn PackIndex::find_offset(self : PackIndex, id :
ObjectId
) -> Int64?

#
PackIndex::find_offset_hex

fn PackIndex::find_offset_hex(self : PackIndex, hex : String) -> Int64?

#
PackIndex::hex_ids

fn PackIndex::hex_ids(self : PackIndex) -> Array[String]

All object ids as hex, materialized lazily and cached. Only the object enumeration paths (fsck, cat-file --batch-all-objects, pack-redundant, commit-graph) need this; normal lookups binary-search on raw bytes and never allocate hex.

#
PackIndex::id_at

Object id at position i (raw bytes → ObjectId, no hex roundtrip).

#
PackIndex::id_count

fn PackIndex::id_count(self : PackIndex) -> Int

Number of objects indexed.

#
PackIndex::id_hex_at

fn PackIndex::id_hex_at(self : PackIndex, i : Int) -> String

Hex of the object id at position i.

#
PromisorDb

pub struct PromisorDb {
db : ObjectDb
git_dir : String
promisor_remote : String?
fetched : Map[String, Bool]
fetch_fn : async (String, Array[
ObjectId
]) -> Result[Array[
PackObject
],
GitError
] noraise?
}

Promisor-aware object database that can fetch missing objects. The fetch_fn callback is injectable for platform independence. When fetch_fn is None, only local operations are available.

#
PromisorDb::fetch_missing

Fetch missing objects from the promisor remote (async). Requires fetch_fn to be set; returns empty if no fetcher available.

#
PromisorDb::fetch_one

Fetch a single missing object (async)

#
PromisorDb::get_or_fetch

Get object, fetching from remote if necessary (async version)

#
PromisorDb::get_promisor_remote

fn PromisorDb::get_promisor_remote(self : PromisorDb) -> String?

Get the promisor remote URL if available

#
PromisorDb::has_local

Check if an object exists locally

#
PromisorDb::has_promisor

fn PromisorDb::has_promisor(self : PromisorDb) -> Bool

Check if this is a partial clone with promisor remote

#
PruneResult

pub struct PruneResult {
pruned : Array[
ObjectId
]
}

#
PrunedWorktreeEntry

pub(all) struct PrunedWorktreeEntry {
name : String
reason : String
}

#
PushRefspec

pub(all) struct PushRefspec {
force : Bool
src : String
dst : String
}

#
PushUpdate

pub struct PushUpdate {
refname : String
old_id :
ObjectId
?
new_id :
ObjectId
?
}

#
RebaseResult

pub struct RebaseResult {
status : RebaseStatus
commit_id :
ObjectId
?
conflicts : Array[String]
rewritten : Array[(
ObjectId
,
ObjectId
)]
}

#
RebaseState

pub struct RebaseState {
onto :
ObjectId

orig_head :
ObjectId

head_name : String
todo : Array[
ObjectId
]
done : Array[
ObjectId
]
current :
ObjectId
?
message : String
author : String
author_time : Int64
author_tz : String
rewritten : Array[(
ObjectId
,
ObjectId
)]
}

#
RebaseStatus

pub enum RebaseStatus {
Complete
Conflict
NothingToRebase
}

#
ReceivePackProcResult

pub(all) struct ReceivePackProcResult {
refname : String
original_refname : String
old_id : String
new_id : String
status : String
message : String
fall_through : Bool
}

Result from a proc-receive hook for a single ref.

#
ReceivePackRequest

pub(all) struct ReceivePackRequest {
updates : Array[RefUpdate]
capabilities : Array[String]
pack : Bytes
push_options : Array[String]
cert_push_options : Array[String]
has_push_cert : Bool
}

#
ReceivePackResult

pub(all) struct ReceivePackResult {
updated : Array[String]
rejected : Array[(String, String)]
unpack_error : String?
connectivity_error_oid : String?
}

#
RefUpdate

pub(all) struct RefUpdate {
old_id :
ObjectId

new_id :
ObjectId

refname : String
}

#
ReflogEntry

pub struct ReflogEntry {
old_id :
ObjectId

new_id :
ObjectId

author : String
email : String
timestamp : Int64
timezone : String
message : String
}

#
RemoteConfig

pub(all) struct RemoteConfig {
urls : Array[String]
pushurls : Array[String]
fetch : Array[String]
push : Array[String]
promisor : Bool
partial_clone_filter : String?
mirror : Bool
tagopt : String?
}

#
RemoteHeadState

pub enum RemoteHeadState {
Missing
Detached(String)
Symref(String)
Other(String)
}

#
RepackResult

pub struct RepackResult {
pack_id :
ObjectId

object_count : Int
pack_bytes : Int
}

#
ResetMode

pub(all) enum ResetMode {
Soft
Mixed
Hard
}

#
ResolveUndoEntry

pub struct ResolveUndoEntry {
path : String
base : ResolveUndoStage?
ours : ResolveUndoStage?
theirs : ResolveUndoStage?
}

#
ResolveUndoStage

pub struct ResolveUndoStage {
mode : Int
id :
ObjectId

}

#
StashEntry

pub struct StashEntry {
id :
ObjectId

message : String
}

#
StashPatchHunk

pub(all) struct StashPatchHunk {
path : String
display_lines : Array[String]
}

#
Status

pub struct Status {
staged_added : Array[String]
staged_modified : Array[String]
staged_deleted : Array[String]
unstaged_modified : Array[String]
unstaged_deleted : Array[String]
untracked : Array[String]
}

#
TextAttr

pub enum TextAttr {
Auto
Set
Unset
Unspecified
}

#
TodoCommand

pub enum TodoCommand {
Pick
Reword
Edit
Squash
Fixup
Drop
Exec
Break
Label
Reset
Merge
} derive(Eq,
Debug
)

impl Show for TodoCommand

#
TreeFileEntry

pub struct TreeFileEntry {
id :
ObjectId

mode : Int
}

#
UploadPackConfig

pub(all) struct UploadPackConfig {
allow_filter : Bool
blob_packfile_uri : String?
allow_ref_in_want : Bool
}

Upload-pack configuration for v2 protocol

#
UploadPackConfig::default

#
UploadPackConfig::new

fn UploadPackConfig::new(allow_filter : Bool, blob_packfile_uri : String?, allow_ref_in_want : Bool) -> UploadPackConfig

#
UploadPackRequest

pub struct UploadPackRequest {
wants : Array[
ObjectId
]
haves : Array[
ObjectId
]
capabilities : Array[String]
done : Bool
shallow : Array[
ObjectId
]
deepen : Int?
}

#
UploadPackRequestV2

pub struct UploadPackRequestV2 {
command : String
capabilities : Array[String]
wants : Array[
ObjectId
]
want_refs : Array[String]
haves : Array[
ObjectId
]
done : Bool
filter : String?
packfile_uris : String?
}

Protocol v2 upload-pack request

#
WorktreeInfo

pub(all) struct WorktreeInfo {
path : String
head_id :
ObjectId
?
branch : String?
locked : Bool
is_main : Bool
is_bare : Bool
}

Information about a worktree.

#
WorktreeRepairResult

pub(all) struct WorktreeRepairResult {
repaired : Array[String]
warnings : Array[String]
} derive(Eq,
Debug
)

#
add_paths

Add files to index (like git add).

#
add_paths_async

async fn add_paths_async(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, paths : Array[String], run_filter_cmd? : FilterCmd, warnings? : Array[String]) -> Unit raise
GitError

Add files to index with worktree mode detection (native).

#
append_reflog

fn append_reflog(wfs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, refname : String, old_id :
ObjectId
, new_id :
ObjectId
, author : String, email : String, timestamp : Int64, timezone : String, message : String) -> Unit raise
GitError

Append a reflog entry.

#
apply_config_overrides

fn apply_config_overrides(remotes : Map[String, RemoteConfig], branches : Map[String, BranchConfig], overrides : Array[(String, String)]) -> Unit

#
apply_filter_smudge

async fn apply_filter_smudge(rfs : &
RepoFileSystem
, content : Bytes, attrs : FileEolAttrs, root : String, git_dir : String, run_filter_cmd : FilterCmd?) -> Bytes raise
GitError

Apply the external filter driver's smudge command (blob -> worktree), e.g. from .gitattributes' filter=name. Returns content unchanged when no filter is configured for the path, the filter is lfs (handled separately by pointer resolution), or no run_filter_cmd callback / smudge command is available.

#
apply_receive_pack

fn apply_receive_pack(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, req : ReceivePackRequest, skip_connectivity_check? : Bool, git_dir_override? : String) -> ReceivePackResult raise
GitError

#
apply_template

fn apply_template(wfs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, template_dir : String) -> Unit raise
GitError

Copy template directory contents to git directory. This should be called after init_repo_with_options if template_dir is specified.

#
autosquash_interactive_todo

fn autosquash_interactive_todo(entries : Array[InteractiveTodoEntry]) -> Array[InteractiveTodoEntry]

Reorder todo entries for autosquash: move fixup!/squash! commits after their targets.

#
bisect_get_candidates

BFS candidate computation for bisect. Returns commits between bad and good that are not skipped.

#
bisect_mark_ancestors

fn bisect_mark_ancestors(db : ObjectDb, rfs : &
RepoFileSystem
, start :
ObjectId
, set : Map[String, Bool]) -> Unit

Mark all ancestors of a commit in the given set (BFS).

#
bisect_shell_quote_args

fn bisect_shell_quote_args(args : Array[String]) -> String

Shell-quote arguments for bisect run command string.

#
bisect_steps

fn bisect_steps(n : Int) -> Int

Calculate the number of bisect steps remaining (log2).

#
build_receive_pack_advertisement

fn build_receive_pack_advertisement(fs : &
RepoFileSystem
, root : String, agent? : String, protocol_version? : Int, extra_haves? : Array[
ObjectId
], git_dir_override? : String, advertise_push_options? : Bool, cert_nonce? : String) -> Bytes raise
GitError

Build receive-pack advertisement (info/refs payload).

#
build_upload_pack_advertisement

fn build_upload_pack_advertisement(fs : &
RepoFileSystem
, root : String, agent? : String, protocol_version? : Int) -> Bytes raise
GitError

Build upload-pack advertisement (info/refs payload).

#
build_upload_pack_config_with_overrides

fn build_upload_pack_config_with_overrides(fs : &
RepoFileSystem
, root : String, overrides : Map[String, String]) -> UploadPackConfig

#
check_shorthand_ambiguity

fn check_shorthand_ambiguity(url : String, dir_exists : (String) -> Bool) -> String?

#
check_unsupported_gitattributes

fn check_unsupported_gitattributes(rfs : &
RepoFileSystem
, root : String) -> String?

Check if .gitattributes has unsupported attributes (filter=lfs, working-tree-encoding). Generic filter= (other than lfs) is now handled natively.

#
checkout

fn checkout(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, spec : String, detach? : Bool, update_worktree? : Bool, update_index? : Bool) ->
ObjectId
raise
GitError

#
cherry_pick

fn cherry_pick(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, commit_id :
ObjectId
, author : String, timestamp : Int64, allow_empty? : Bool, no_commit? : Bool, message_suffix? : String, signoff_committer? : String) -> CherryPickResult raise
GitError

Cherry-pick a single commit onto current HEAD.

#
clean_for_storage

fn clean_for_storage(content : Bytes, attrs : FileEolAttrs, autocrlf : AutoCrlf) -> Bytes

Clean: WT→blob normalization considering gitattributes text/eol.

#
clear_rebase_state

Clear rebase state (remove .git/rebase-merge/)

#
collect_commit_tree_only

Collect objects for a single commit without walking parent history. Used for subdir-push where parent history already exists on remote.

#
collect_diff_objects

Collect diff objects between base and new commit. Only collects objects that don't exist in the base tree. Used for subdir-push where base objects already exist on remote.

#
collect_local_branches

fn collect_local_branches(fs : &
RepoFileSystem
, git_dir : String) -> Array[String]

#
collect_loose_ref_ids

fn collect_loose_ref_ids(fs : &
RepoFileSystem
, dir : String, prefix : String, out : Map[String,
ObjectId
], filter_prefix : String?) -> Unit

#
collect_packed_ref_ids

fn collect_packed_ref_ids(fs : &
RepoFileSystem
, git_dir : String, out : Map[String,
ObjectId
], filter_prefix : String?) -> Unit

#
collect_reachable_objects_excluding_commits

Collect objects reachable from commits, stopping before any commit in excluded_commits. This models upload-pack negotiation: a client's have commits delimit the history it already owns, so their trees and ancestors do not need a separate reachability walk.

#
collect_reachable_objects_from_commits

Collect reachable objects from multiple commits (deduplicated).

#
collect_tree_files_from_commit

#
commit

fn commit(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, message : String, author : String, author_timestamp : Int64, committer? : String, committer_timestamp? : Int64, allow_empty? : Bool, timezone? : String, encoding? : String, author_timezone? : String?, committer_timezone? : String?, algo? :
HashAlgorithm
) ->
ObjectId
raise
GitError

@bit.Commit current index and update HEAD.

#
commit_amend

fn commit_amend(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, message : String, author : String, author_timestamp : Int64, committer? : String, committer_timestamp? : Int64, timezone? : String, encoding? : String, author_timezone? : String?, committer_timezone? : String?, algo? :
HashAlgorithm
) ->
ObjectId
raise
GitError

Commit with amend (replace the last commit).

#
commit_apply_signoff

fn commit_apply_signoff(msg : String, committer~ : String) -> String

Apply Signed-off-by trailer to a commit message. The committer parameter is the committer identity string (e.g. "Name ").

#
commit_is_trailer_line

fn commit_is_trailer_line(line : String) -> Bool

Check if a line is a trailer line (e.g., "Signed-off-by: ...").

#
commit_strip_message

fn commit_strip_message(msg : String) -> String

Strip comment lines and trailing/leading blank lines from a commit message.

#
compat_append_loose_object_idx

#
compat_lookup_loose_object_idx

fn compat_lookup_loose_object_idx(rfs : &
RepoFileSystem
, git_dir : String, spec : String) -> String?

#
compat_lookup_object_id

#
compat_record_annotated_tag_mapping

fn compat_record_annotated_tag_mapping(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, storage_id :
ObjectId
, target :
ObjectId
, target_type : String, name : String, message : String, tagger : String, timestamp : Int64, timezone : String) -> Unit raise
GitError

#
compat_record_blob_mapping

fn compat_record_blob_mapping(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, storage_id :
ObjectId
, content : Bytes) -> Unit raise
GitError

#
compat_record_commit_mapping

#
compat_record_tree_mapping

#
config_has_remote_section

fn config_has_remote_section(blocks : Array[ConfigBlock], name : String) -> Bool

#
config_strip_quotes

fn config_strip_quotes(s : String) -> String

#
convert_lf_to_crlf

fn convert_lf_to_crlf(content : Bytes) -> Bytes

LF→CRLF expansion (smudge direction).

#
core_filemode_enabled

fn core_filemode_enabled(fs : &
RepoFileSystem
, git_dir : String) -> Bool

Return whether executable-bit changes are significant for this repository.

#
create_annotated_tag

fn create_annotated_tag(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, name : String, target :
ObjectId
, message : String, tagger : String, timestamp : Int64, timezone? : String) -> Unit raise
GitError

Create an annotated tag.

#
create_branch

fn create_branch(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, name : String, start_point? : String?, author? : String, email? : String, timestamp? : Int64, timezone? : String) -> Unit raise
GitError

Create a local branch pointing at current HEAD.

#
create_branch_at

fn create_branch_at(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, name : String, commit_id :
ObjectId
, start_point? : String?, author? : String, email? : String, timestamp? : Int64, timezone? : String) -> Unit raise
GitError

Create a local branch pointing at a specific commit.

#
create_lightweight_tag

Create a lightweight tag.

#
create_reflog

fn create_reflog(wfs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, refname : String) -> Unit raise
GitError

Create an empty reflog file for a ref.

#
create_worktree

fn create_worktree(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, worktree_path : String, commit_ish : String?, detach? : Bool, force? : Bool, new_branch~ : String?, relative_paths? : Bool?, orphan? : Bool, checkout_files? : Bool) -> Unit raise
GitError

Create a new linked worktree.

#
decode_commit_message_bytes

fn decode_commit_message_bytes(data : Bytes, encoding : String) -> String

Decode commit message bytes, handling ISO-8859-1 and UTF-8 encodings.

#
delete_branch

fn delete_branch(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, name : String, force? : Bool) -> Unit raise
GitError

Delete a local branch. Fails if it's the current branch.

#
delete_reflog

fn delete_reflog(wfs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, refname : String) -> Unit raise
GitError

Delete a reflog file.

#
delete_tag

Delete a tag.

#
detect_git_dir

fn detect_git_dir(fs : &
RepoFileSystem
, path : String) -> (String, Bool)?

#
detect_protocol_version

fn detect_protocol_version(data : Bytes) -> Int

Detect protocol version from request bytes Returns 1 for v1 (want lines), 2 for v2 (command=...)

#
diff_index

Diff index against HEAD (git diff --cached).

#
diff_stat

fn diff_stat(files : Array[DiffFile]) -> Array[String]

Format diff as stat summary (like git diff --stat).

#
diff_text

fn diff_text(files : Array[DiffFile]) -> Array[String]

Format diff as unified text.

#
diff_tree_abbrev_hex

fn diff_tree_abbrev_hex(hex : String, abbrev : Int?) -> String

Truncate a hex string to the given abbreviation length.

#
diff_tree_filter_matches

fn diff_tree_filter_matches(filter : String?, status : String) -> Bool

Check if a diff status character matches a filter string.

#
diff_trees

Diff two trees by their ObjectIds. Returns DiffFile array.

#
diff_worktree

async fn diff_worktree(fs : &
RepoFileSystem
, root : String, run_filter_cmd? : FilterCmd) -> Array[DiffFile] raise
GitError

Diff working tree against index (default git diff).

#
execute_interactive_todo

async fn execute_interactive_todo(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, state : InteractiveRebaseState, message_editor : async (String) -> String?, exec_runner? : async (String) -> Int?) -> InteractiveRebaseResult raise
GitError

#
expand_sparse_index_entries

fn expand_sparse_index_entries(fs : &
RepoFileSystem
, git_dir : String, entries : Array[IndexEntry]) -> Array[IndexEntry] raise
GitError

#
expand_sparse_skip_worktree_paths

fn expand_sparse_skip_worktree_paths(fs : &
RepoFileSystem
, git_dir : String, entries : Array[IndexEntry], skip_worktree_paths : Map[String, Bool]) -> Map[String, Bool] raise
GitError

#
fast_forward_to

#
format_remove_warning

fn format_remove_warning(branches : Array[String]) -> String

#
fsck_connectivity_check

fn fsck_connectivity_check(db : ObjectDb, fs : &
RepoFileSystem
, tips : Array[
ObjectId
], collect_extra? : Bool) -> FsckResult

BFS connectivity walk from multiple tips. Returns reachable set, missing set, root commits, tag objects, and error count. This is the pure core of fsck — no filesystem access, no stderr output.

#
fsck_enumerate_objects

fn fsck_enumerate_objects(db : ObjectDb) -> Array[String]

Enumerate all object hex IDs from ObjectDb (loose + packed).

#
fsck_object_type

fn fsck_object_type(db : ObjectDb, fs : &
RepoFileSystem
, hex : String) -> String

Get the type name of an object by hex ID.

#
fsck_verify_loose_hash

fn fsck_verify_loose_hash(raw : Bytes, expected_hex : String) -> Bool

Verify a single loose object's hash. Returns true if valid.

#
gc_repo

Run a lightweight gc: repack reachable objects and report unreachable ids.

#
generate_interactive_todo_text

#
get_effective_remote_url

fn get_effective_remote_url(fs : &
RepoFileSystem
, git_dir : String) -> String?

Get effective remote URL - prefers subdir remote over config

#
get_protocol_version

fn get_protocol_version() -> Int

#
get_reflog_path

fn get_reflog_path(git_dir : String, refname : String) -> String

Get the reflog file path for a given ref.

#
get_remote_url

fn get_remote_url(fs : &
RepoFileSystem
, git_dir : String, name : String) -> String?

#
get_subdir_info

fn get_subdir_info(fs : &
RepoFileSystem
, git_dir : String) -> (String, String, String)?

Get subdir info for display (remote, path, base)

#
get_subdir_tree_from_commit

Get the subdir tree from a commit (for subdir-clone operations)

#
get_worktree_lock_reason

fn get_worktree_lock_reason(rfs : &
RepoFileSystem
, root : String, worktree_path : String) -> String? raise
GitError

Get lock reason for a worktree.

#
get_worktree_prunable_reason

fn get_worktree_prunable_reason(rfs : &
RepoFileSystem
, root : String, worktree_path : String) -> String? raise
GitError

Check if a worktree is prunable and return the reason.

#
has_any_filter_attributes

fn has_any_filter_attributes(rfs : &
RepoFileSystem
, root : String) -> Bool

Check if .gitattributes has any filter= attributes (for storage runtime bypass).

#
history_fixup

Orchestrate history fixup: fold index_tree (the staged tree) into target_id, then replay every descendant of target_id that is reachable from the selected tips. Objects are written but no refs are touched; the caller applies (or prints) the returned ref updates.

tips is the list of (refname, commit) refs to consider updating (e.g. all branches + HEAD, or just HEAD). Only tips that have target_id as an ancestor are rewritten.

#
history_reword

Rewrite a commit's message in place (same tree, parents, author, and committer) and replay its descendants. Core of git history reword. If the new message equals the old one, the rewritten commit hashes to the same id and the result contains no ref updates.

#
init_repo

fn init_repo(fs : &
FileSystem
, root : String, default_branch? : String, bare? : Bool) -> Unit raise
GitError

Initialize a repository at root with a default branch. If bare is true, creates a bare repository (no working tree). If the repository already exists, this is a reinit and preserves existing HEAD.

#
init_repo_with_options

fn init_repo_with_options(fs : &
FileSystem
, root : String, opts : InitOptions) -> Unit raise
GitError

Initialize a repository with full options. If separate_git_dir is set, this version does not inspect the existing .git target and only updates .git atomically.

#
init_repo_with_options_with_repo_fs

fn init_repo_with_options_with_repo_fs(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, opts : InitOptions) -> Unit raise
GitError

Initialize a repository with full options and full .git resolution via RepoFileSystem. This is used when reinitializing with --separate-git-dir to migrate existing data.

#
insert_exec_after_picks

fn insert_exec_after_picks(entries : Array[InteractiveTodoEntry], exec_cmds : Array[String]) -> Array[InteractiveTodoEntry]

Insert exec commands after each pick/reword/edit entry in a todo list. git behavior: --exec "cmd" inserts exec cmd after every pick line.

#
interactive_rebase_abort_impl

#
interactive_rebase_continue_impl

async fn interactive_rebase_continue_impl(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, message_editor : async (String) -> String?, exec_runner? : async (String) -> Int?) -> InteractiveRebaseResult raise
GitError

#
interactive_rebase_skip_impl

async fn interactive_rebase_skip_impl(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, message_editor : async (String) -> String?, exec_runner? : async (String) -> Int?) -> InteractiveRebaseResult raise
GitError

#
interactive_rebase_start

async fn interactive_rebase_start(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, upstream :
ObjectId
, onto :
ObjectId
, sequence_editor : async (String) -> String?, message_editor : async (String) -> String?, autosquash? : Bool, exec_runner? : async (String) -> Int?, exec_cmds? : Array[String], update_refs? : Bool, root_mode? : Bool, rebase_merges? : Bool) -> InteractiveRebaseResult raise
GitError

Start an interactive rebase. The sequence_editor callback is invoked with the generated todo text and should return Some(edited_text) to proceed or None to abort.

#
is_ancestor_of

fn is_ancestor_of(fs : &
RepoFileSystem
, git_dir : String, ancestor :
ObjectId
, descendant :
ObjectId
) -> Bool

Check if ancestor is an ancestor of descendant via BFS.

#
is_bare_git_dir

fn is_bare_git_dir(git_dir : String) -> Bool

#
is_binary_bytes

fn is_binary_bytes(content : Bytes) -> Bool

#
is_branch_checked_out

fn is_branch_checked_out(fs : &
RepoFileSystem
, root : String, branch : String) -> String? raise
GitError

Check if a branch is checked out in any worktree. Returns the worktree path if the branch is in use, None otherwise.

#
is_branch_checked_out_elsewhere

fn is_branch_checked_out_elsewhere(fs : &
RepoFileSystem
, root : String, branch : String) -> String? raise
GitError

Check if a branch is checked out in a worktree other than root (e.g. after git worktree add -f lets two worktrees share one branch, and the current worktree happens to be one of them). Returns the other worktree's path if found, None otherwise.

#
is_ignored_path

fn is_ignored_path(fs : &
RepoFileSystem
, root : String, rel_path : String, is_dir : Bool) -> Bool raise
GitError

Check if a relative path is ignored by .gitignore files under root.

#
is_interactive_rebase_in_progress

fn is_interactive_rebase_in_progress(rfs : &
RepoFileSystem
, git_dir : String) -> Bool

Check if an interactive rebase is in progress.

#
is_lfs_pointer

fn is_lfs_pointer(content : Bytes) -> Bool

#
is_mirror_fetch_config

fn is_mirror_fetch_config(rc : RemoteConfig) -> Bool

#
is_partial_clone

fn is_partial_clone(fs : &
RepoFileSystem
, git_dir : String) -> Bool

Check if this is a partial clone repository

#
is_rebase_in_progress

fn is_rebase_in_progress(fs : &
RepoFileSystem
, git_dir : String) -> Bool

Check if a rebase is in progress.

#
is_remote_namespace

fn is_remote_namespace(dst : String, remote_name : String) -> Bool

#
is_sparse_checkout_cone_enabled

fn is_sparse_checkout_cone_enabled(rfs : &
RepoFileSystem
, git_dir : String) -> Bool

#
is_sparse_checkout_enabled

fn is_sparse_checkout_enabled(rfs : &
RepoFileSystem
, git_dir : String) -> Bool

Check if sparse checkout is enabled.

#
is_subdir_clone

fn is_subdir_clone(fs : &
RepoFileSystem
, git_dir : String) -> Bool

Check if current directory is a subdir-clone

#
is_valid_remote_name

fn is_valid_remote_name(name : String) -> Bool

#
last_modified_collect_entries

fn last_modified_collect_entries(db : ObjectDb, fs : &
RepoFileSystem
, tree_id :
ObjectId
, prefix : String, depth : Int, max_depth : Int, show_trees : Bool, pathspecs : Array[String], out : Array[LmPath]) -> Unit raise
GitError

Collect the entries of tree_id honoring last-modified's depth model. max_depth < 0 = unlimited (-r); 0 (default) = top-level only; a tree reached at exactly max_depth is emitted as a tree leaf; trees above it are descended and only shown when show_trees. A subtree named by a pathspec is always descended so the named paths can be reached.

#
last_modified_committer_ts

fn last_modified_committer_ts(data : Bytes) -> Int64

Parse the committer timestamp (unix seconds) from a raw commit object.

#
last_modified_compute

fn last_modified_compute(db : ObjectDb, fs : &
RepoFileSystem
, start_id :
ObjectId
, spec : String, max_depth : Int, show_trees : Bool, max_count : Int, bottoms : Array[
ObjectId
], pathspecs : Array[String]) -> Array[LmResult] raise
GitError

Compute the last-modified attribution for the tree of start commit. start_id must already be resolved (e.g. via rev-parse) to a commit-ish.

#
last_modified_pathspec_matches

fn last_modified_pathspec_matches(path : String, pathspecs : Array[String]) -> Bool

Minimal pathspec matcher: exact path, directory prefix, or a trailing /* wildcard. Empty list matches everything.

#
last_modified_resolve_commitish

Peel id (commit/tag) to a commit; error with git's message if it is a tree.

#
legacy_remote_exists

fn legacy_remote_exists(rfs : &
RepoFileSystem
, git_dir : String, name : String) -> Bool

#
lfs_get_cached_content

fn lfs_get_cached_content(rfs : &
RepoFileSystem
, git_dir : String, oid : String) -> Bytes?

Read an LFS object from the local cache. Returns None if not cached.

#
lfs_is_valid_http_url

fn lfs_is_valid_http_url(url : String) -> Bool

Validate that a URL has an http:// or https:// scheme.

#
lfs_object_path

fn lfs_object_path(git_dir : String, oid : String) -> String

#
lfs_verify_oid

fn lfs_verify_oid(data : Bytes, expected_oid : String) -> Bool

Verify that downloaded data matches the expected LFS OID (SHA-256).

#
list_branches

List local branches with current flag.

#
list_branches_text

fn list_branches_text(fs : &
RepoFileSystem
, git_dir : String) -> Array[String] raise
GitError

Format like git branch output.

#
list_branches_verbose

fn list_branches_verbose(fs : &
RepoFileSystem
, git_dir : String) -> Array[String] raise
GitError

List branches with commit hash and subject (verbose mode).

#
list_refs_with_ids

fn list_refs_with_ids(fs : &
RepoFileSystem
, git_dir : String, filter_prefix : String?) -> Map[String,
ObjectId
]

#
list_remote_branches

fn list_remote_branches(fs : &
RepoFileSystem
, git_dir : String) -> Array[String]

List remote tracking branches.

#
list_remote_tracking_refs

fn list_remote_tracking_refs(fs : &
RepoFileSystem
, git_dir : String, remote_name : String) -> Map[String,
ObjectId
]

#
list_remotes

fn list_remotes(fs : &
RepoFileSystem
, git_dir : String) -> Array[String]

#
list_remotes_verbose

fn list_remotes_verbose(fs : &
RepoFileSystem
, git_dir : String) -> Array[(String, String)]

#
list_tags

fn list_tags(fs : &
RepoFileSystem
, git_dir : String) -> Array[String]

List all tags.

#
list_working_files

fn list_working_files(fs : &
RepoFileSystem
, root : String) -> Array[String] raise
GitError

List files under root, excluding ignored paths and .git.

#
list_working_files_async

async fn list_working_files_async(fs : &
RepoFileSystem
, root : String) -> Array[String] raise
GitError

List files under root, excluding ignored paths and .git.

#
list_worktrees

List all worktrees in a repository. Returns the main worktree first, followed by linked worktrees.

#
load_all_objects_from_fs

#
load_all_objects_from_object_dir

#
load_interactive_rebase_state

fn load_interactive_rebase_state(rfs : &
RepoFileSystem
, git_dir : String) -> InteractiveRebaseState? raise
GitError

#
load_object_store_from_fs

#
load_rebase_state

Load rebase state from .git/rebase-merge/

#
lock_worktree

fn lock_worktree(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, worktree_path : String, reason~ : String?) -> Unit raise
GitError

Lock a worktree to prevent it from being pruned.

#
log_head

fn log_head(fs : &
RepoFileSystem
, git_dir : String, max_count? : Int, since? : Int64, until? : Int64, include_parent_tree? : Bool) -> Array[LogEntry] raise
GitError

Read commit history from HEAD.

#
log_head_oneline

fn log_head_oneline(fs : &
RepoFileSystem
, git_dir : String, max_count? : Int, since? : Int64, until? : Int64) -> Array[String] raise
GitError

Format like git log --oneline.

#
match_url_pattern

fn match_url_pattern(pattern : String, value : String) -> Bool

#
matches_sparse_pattern

fn matches_sparse_pattern(path : String, patterns : Array[String]) -> Bool

Check if a path matches any of the sparse checkout patterns.

#
merge

fn merge(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, target :
ObjectId
, message : String, author : String, timestamp : Int64, ours_label? : String, theirs_label? : String) -> MergeResult raise
GitError

#
merge_base_all

Find all merge bases between two commits. A merge base is a common ancestor that is not an ancestor of any other common ancestor.

#
merge_base_independent

Find independent commits: those not reachable from any other in the set.

#
merge_base_is_ancestor

Check if ancestor is an ancestor of descendant using BFS.

#
move_directory

fn move_directory(rfs : &
RepoFileSystem
, wfs : &
FileSystem
, src : String, dst : String) -> Unit

#
move_tree_safe

#
move_worktree

fn move_worktree(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, source_path : String, dest_path : String, force? : Bool, force_level? : Int, relative_paths? : Bool?) -> Unit raise
GitError

Move a worktree to a new location.

#
mv_path

fn mv_path(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, source : String, dest : String, force? : Bool) -> Unit raise
GitError

Move/rename a file in the index and working tree.

#
normalize_crlf_to_lf

fn normalize_crlf_to_lf(content : Bytes) -> Bytes

#
normalize_index_pathspec_path

fn normalize_index_pathspec_path(path : String) -> String

Strip leading ./ and trailing / from an index pathspec path.

#
normalize_remote_branch_name

fn normalize_remote_branch_name(refname : String) -> String

#
normalize_repo_path

fn normalize_repo_path(path : String) -> String raise
GitError

#
normalize_track_ref

fn normalize_track_ref(track : String) -> String

#
normalize_worktree_content

fn normalize_worktree_content(content : Bytes, autocrlf : AutoCrlf) -> Bytes

#
parse_at_minus_prefix

fn parse_at_minus_prefix(spec : String) -> (Int, String)?

Parse @{-N} prefix. Returns (N, rest_of_spec).

#
parse_config_blocks

fn parse_config_blocks(content : String) -> Array[ConfigBlock]

#
parse_config_kv

fn parse_config_kv(line : String) -> (String, String)?

#
parse_config_override_pairs

fn parse_config_override_pairs() -> Array[(String, String)]

#
parse_config_overrides

fn parse_config_overrides() -> Map[String, String]

Parse config overrides from GIT_CONFIG_OVERRIDES environment variable

#
parse_date_to_timestamp

fn parse_date_to_timestamp(date_str : String) -> Int64

Parse a date string to a Unix timestamp.

#
parse_fetch_refspecs

fn parse_fetch_refspecs(specs : Array[String]) -> Array[FetchRefspec]

#
parse_github_shorthand

fn parse_github_shorthand(url : String) -> GitHubShorthand?

#
parse_index_pathspec

fn parse_index_pathspec(spec : String) -> (Int, String?)

Parse index pathspec like :0:path or :path.

#
parse_interactive_todo

fn parse_interactive_todo(text : String) -> Array[InteractiveTodoEntry]

#
parse_iso8601_timestamp

fn parse_iso8601_timestamp(date_str : String) -> Int64

Parse ISO 8601 timestamp (YYYY-MM-DDTHH:MM:SS).

#
parse_lfs_pointer

fn parse_lfs_pointer(content : Bytes) -> LfsPointer?

#
parse_push_refspecs

fn parse_push_refspecs(specs : Array[String]) -> Array[PushRefspec]

#
parse_receive_pack_request

fn parse_receive_pack_request(data : Bytes) -> ReceivePackRequest raise
GitError

#
parse_reflog_date_selector

fn parse_reflog_date_selector(spec : String) -> (String, String)?

Parse a reflog date selector like main@{May 25 2005} or HEAD@{2005-05-26}. Returns (refname, date_string) when the content is non-numeric.

#
parse_reflog_selector

fn parse_reflog_selector(spec : String) -> (String, Int)?

Parse a reflog numeric selector like main@{2} or @{0}. Returns (refname, index) where refname is canonicalised.

#
parse_refspec_pair

fn parse_refspec_pair(spec : String) -> (String, String)

#
parse_remote_config

fn parse_remote_config(content : String) -> (Map[String, RemoteConfig], Map[String, BranchConfig])

#
parse_rev_parse_short_length

fn parse_rev_parse_short_length(value : String) -> Int?

Parse --short=N value into an integer.

#
parse_section_header

fn parse_section_header(line : String) -> (String, String?)

#
parse_tag_object

fn parse_tag_object(data : String) ->
ObjectId
? raise

Parse a tag object string to extract the target object ID. Returns the ObjectId of the tagged object (from the "object " line).

#
parse_upload_pack_request

fn parse_upload_pack_request(data : Bytes) -> UploadPackRequest raise
GitError

#
parse_upload_pack_request_v2

fn parse_upload_pack_request_v2(data : Bytes) -> UploadPackRequestV2 raise
GitError

Parse protocol v2 upload-pack request

#
parseopt_find_char

fn parseopt_find_char(s : String, ch : Char) -> Int?

Find the index of a specific character in a string.

#
parseopt_find_flags

fn parseopt_find_flags(s : String) -> Int

Find the index of the first flag character (*, =, ?, !).

#
parseopt_find_space

fn parseopt_find_space(s : String) -> Int?

Find the first space or tab in a string.

#
parseopt_skipspaces

fn parseopt_skipspaces(s : String) -> String

Skip leading spaces and tabs.

#
parseopt_split_lines

fn parseopt_split_lines(s : String) -> Array[String]

Split a string into lines (parseopt helper).

#
prune_repo

Prune unreachable loose objects (skip if there are no refs).

#
prune_worktrees

fn prune_worktrees(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, dry_run? : Bool) -> Array[String] raise
GitError

Prune worktrees with invalid gitdir references. Returns list of pruned admin directory names.

#
prune_worktrees_detailed

fn prune_worktrees_detailed(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, dry_run? : Bool, expire_before_sec? : Int64?) -> Array[PrunedWorktreeEntry] raise
GitError

#
read_assume_unchanged_paths

fn read_assume_unchanged_paths(fs : &
RepoFileSystem
, git_dir : String, hash_size? : Int) -> Map[String, Bool]

#
read_autocrlf_setting

fn read_autocrlf_setting(fs : &
RepoFileSystem
, git_dir : String) -> AutoCrlf

#
read_config_bool

fn read_config_bool(fs : &
RepoFileSystem
, config_path : String, section : String, name : String) -> Bool?

#
read_config_content

fn read_config_content(rfs : &
RepoFileSystem
, git_dir : String) -> String

#
read_config_value

fn read_config_value(fs : &
RepoFileSystem
, config_path : String, section : String, name : String) -> String?

#
read_config_value_from_content

fn read_config_value_from_content(content_str : String, section : String, name : String) -> String?

Read a key from already-decoded config content. Lets the caller share a single read across multiple key lookups when several read_config_value calls happen in a row against the same file (see rev_parse's object-format cluster).

#
read_config_values

fn read_config_values(fs : &
RepoFileSystem
, config_path : String, section : String, name : String) -> Array[String]

Read all values for a given section/key (multi-valued config support).

#
read_core_eol_setting

fn read_core_eol_setting(fs : &
RepoFileSystem
, git_dir : String) -> EolAttr

#
read_diff_function_patterns

fn read_diff_function_patterns(rfs : &
RepoFileSystem
, git_dir : String, diff_driver : String) -> (String?, String?)

#
read_filter_commands

fn read_filter_commands(rfs : &
RepoFileSystem
, git_dir : String, filter_name : String) -> (String?, String?)

Read filter clean/smudge commands from git config.

#
read_head_ref

Read HEAD and return its reference.

#
read_index_entries

#
read_index_stage_entries

#
read_local_remote_head_state

fn read_local_remote_head_state(fs : &
RepoFileSystem
, head_path : String, remote_name : String) -> RemoteHeadState

#
read_promisor_remote

fn read_promisor_remote(fs : &
RepoFileSystem
, git_dir : String) -> String?

Read promisor remote URL from .git/objects/info/promisor

#
read_reflog

fn read_reflog(fs : &
RepoFileSystem
, git_dir : String, refname : String) -> Array[ReflogEntry] raise
GitError

Read reflog entries for a given ref.

#
read_remote_head_branch

fn read_remote_head_branch(fs : &
RepoFileSystem
, remote_git_dir : String) -> String?

#
read_repo_config

fn read_repo_config(fs : &
RepoFileSystem
, git_dir : String) -> (Map[String, RemoteConfig], Map[String, BranchConfig])

#
read_resolve_undo_entries

#
read_skip_worktree_paths

fn read_skip_worktree_paths(fs : &
RepoFileSystem
, git_dir : String, hash_size? : Int) -> Map[String, Bool]

Read skip-worktree paths from both bit sidecar and index extended flags.

#
read_sparse_display_patterns

fn read_sparse_display_patterns(rfs : &
RepoFileSystem
, git_dir : String) -> Array[String] raise
GitError

#
read_sparse_patterns

fn read_sparse_patterns(rfs : &
RepoFileSystem
, git_dir : String) -> Array[String] raise
GitError

Read sparse checkout patterns from .git/info/sparse-checkout.

#
read_subdir_attributes

fn read_subdir_attributes(fs : &
RepoFileSystem
, git_dir : String) -> (String, String, String)?

Read subdir-clone metadata from .git/info/attributes

#
read_unmerged_paths

fn read_unmerged_paths(fs : &
RepoFileSystem
, git_dir : String) -> Map[String, Bool]

#
rebase_abort

async fn rebase_abort(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, run_filter_cmd? : FilterCmd) -> Unit raise
GitError

Abort the current rebase and restore original state.

#
rebase_continue

Continue rebase after resolving conflicts.

#
rebase_onto

Rebase current HEAD onto upstream commit (linear, no conflicts).

#
rebase_skip

Skip the current commit and continue rebase.

#
rebase_start

Start a rebase operation. Returns RebaseResult indicating status.

#
rebase_start_with_onto

Start a rebase operation with an explicit new base.

#
receive_build_status_response

fn receive_build_status_response(result : ReceivePackResult) -> Bytes

#
receive_build_status_response_with_proc

fn receive_build_status_response_with_proc(result : ReceivePackResult, proc_results : Array[ReceivePackProcResult], original_updates? : Array[RefUpdate]) -> Bytes

Build receive-pack status response including proc-receive results. When original_updates is provided, output status lines in the original push order (matching git's behavior). Otherwise fall back to the legacy order (updated, rejected, proc).

#
receive_pack

fn receive_pack(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, data : Bytes, skip_connectivity_check? : Bool, git_dir_override? : String) -> Bytes raise
GitError

#
receive_pack_info_refs_response

fn receive_pack_info_refs_response(fs : &
RepoFileSystem
, root : String, auth_header : String?, token : String, agent? : String) -> HttpResponse raise
GitError

#
receive_pack_response

fn receive_pack_response(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, auth_header : String?, token : String, body : Bytes) -> HttpResponse raise
GitError

#
reflog_exists

fn reflog_exists(fs : &
RepoFileSystem
, git_dir : String, refname : String) -> Bool

Check if a reflog exists for the given ref.

#
refspec_capture

fn refspec_capture(pattern : String, refname : String) -> String?

#
refspec_map_dst

fn refspec_map_dst(src_pat : String, dst_pat : String, refname : String) -> String?

#
remote_set_branches

fn remote_set_branches(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, name : String, branches : Array[String], add : Bool) -> Unit raise
GitError

#
remote_skip_default_update

fn remote_skip_default_update(blocks : Array[ConfigBlock], name : String) -> Bool

#
remove_packed_ref

fn remove_packed_ref(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, refname : String) -> Unit raise
GitError

#
remove_packed_refs_with_prefix

fn remove_packed_refs_with_prefix(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, prefix : String, exact : String) -> Unit raise
GitError

#
remove_ref_path

fn remove_ref_path(fs : &
FileSystem
, rfs : &
RepoFileSystem
, path : String) -> Unit

#
remove_remote_refs

fn remove_remote_refs(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, name : String) -> Unit

#
remove_tree

#
remove_worktree

fn remove_worktree(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, worktree_path : String, force? : Bool, force_level? : Int) -> Unit raise
GitError

Remove a linked worktree.

#
rename_branch

fn rename_branch(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, old_name : String, new_name : String, force? : Bool, author? : String, email? : String, timestamp? : Int64, timezone? : String) -> Unit raise
GitError

Rename a local branch.

#
rename_packed_refs_prefix

fn rename_packed_refs_prefix(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, old_prefix : String, new_prefix : String, old_exact : String, new_exact : String) -> Unit raise
GitError

#
render_config_blocks

fn render_config_blocks(blocks : Array[ConfigBlock]) -> String

#
repack_repo

Repack reachable objects from refs under the repository root.

#
repair_worktree

fn repair_worktree(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, worktree_paths? : Array[String]) -> Array[String] raise
GitError

Repair worktree administrative files.

#
repair_worktree_detailed

fn repair_worktree_detailed(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, worktree_paths? : Array[String], relative_paths? : Bool?) -> WorktreeRepairResult raise
GitError

#
repo_compat_hash_algorithm

fn repo_compat_hash_algorithm(rfs : &
RepoFileSystem
, git_dir : String) ->
HashAlgorithm
?

#
repo_hash_algorithm

#
reset

fn reset(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, spec : String, mode : ResetMode, committer? : String, timestamp? : Int64, timezone? : String) ->
ObjectId
raise
GitError

#
resolve_checkout_common_git_dir

fn resolve_checkout_common_git_dir(fs : &
RepoFileSystem
, git_dir : String) -> String

#
resolve_common_git_dir

fn resolve_common_git_dir(fs : &
RepoFileSystem
, git_dir : String) -> String

Resolve the repository directory that owns shared metadata such as objects, refs, and config. git_dir may be either a .git marker file or an already-resolved linked-worktree administration directory.

#
resolve_diff_driver

fn resolve_diff_driver(rfs : &
RepoFileSystem
, root : String, path : String) -> String?

#
resolve_eol_attrs

fn resolve_eol_attrs(rfs : &
RepoFileSystem
, root : String, path : String) -> FileEolAttrs

Parse .gitattributes and resolve eol attributes for a given path.

#
resolve_gitdir

fn resolve_gitdir(fs : &
RepoFileSystem
, bit_path : String) -> String

#
resolve_lfs_url

fn resolve_lfs_url(rfs : &
RepoFileSystem
, git_dir : String, remote_name : String) -> String

Read LFS URL from git config and remote config.

#
resolve_lfs_url_from_config

fn resolve_lfs_url_from_config(lfs_url? : String, remote_lfs_url? : String, remote_url? : String) -> String

Resolve LFS server URL from pre-read config values. Priority: lfs.url > remote..lfsurl > derive from remote URL.

#
resolve_local_repo_path

fn resolve_local_repo_path(fs : &
RepoFileSystem
, root : String, url : String) -> String?

#
resolve_ref

Resolve a ref to an object id.

#
resolve_ref_for_subdir

fn resolve_ref_for_subdir(fs : &
RepoFileSystem
, git_dir : String, refspec : String) ->
ObjectId
? raise
GitError

Resolve a ref to commit ID, handling both local and remote refs

#
restore_paths

Restore files from index to working tree (like git checkout -- <paths> or git restore <paths>).

#
rev_list_find_range_dots

fn rev_list_find_range_dots(arg : String) -> (Int, Bool)?

Find ".." or "..." in a rev-list argument. Returns (position, is_symmetric).

#
rev_list_glob_match

fn rev_list_glob_match(pattern : String, text : String) -> Bool

Simple glob matching with * and ? wildcards.

#
rev_list_normalize_max_count

fn rev_list_normalize_max_count(max_count : Int?) -> Int?

Filter invalid max_count (negative values become None).

#
rev_list_normalize_skip

fn rev_list_normalize_skip(skip_count : Int) -> Int

Clamp skip to non-negative.

#
rev_list_window

fn rev_list_window(length : Int, skip_count : Int, max_count : Int?) -> (Int, Int)

Compute start/end indices for skip/max-count window.

#
rev_parse_apply_prefix_to_colon_path

fn rev_parse_apply_prefix_to_colon_path(spec : String, prefix : String) -> String

Apply --prefix to revision:path specs with relative paths.

#
rev_parse_extract_tag_target_name

fn rev_parse_extract_tag_target_name(tag_text : String) -> String?

Extract the object header hex from tag text.

#
rev_parse_git_path_uses_common_dir

fn rev_parse_git_path_uses_common_dir(requested_path : String) -> Bool

Check whether a git path should use the common directory.

#
rev_parse_glob_match

fn rev_parse_glob_match(text : String, pattern : String) -> Bool

Glob match for ref patterns. Supports * (any chars) and ? (single char). Non-glob patterns match as exact or path prefix (with / boundary).

#
rev_parse_is_inside_git_dir

fn rev_parse_is_inside_git_dir(cwd_abs : String, abs_git_dir : String) -> Bool

Check whether cwd is inside the git directory.

#
rev_parse_make_relative

fn rev_parse_make_relative(abs_target : String, cwd_abs : String) -> String

Compute a relative path from cwd_abs to abs_target.

#
rev_parse_normalize_glob_pattern

fn rev_parse_normalize_glob_pattern(pattern : String) -> String

Normalize a glob pattern by expanding shorthand prefixes. "heads/*" -> "refs/heads/*", "refs/heads/*" unchanged.

#
rev_parse_normalize_path

fn rev_parse_normalize_path(path : String) -> String

Normalize a path by resolving . and .. components.

#
rev_parse_parse_config_bool

fn rev_parse_parse_config_bool(raw : String) -> Bool?

Parse a boolean config value (true/yes/1/false/no/0).

#
rev_parse_parse_parent_suffix

fn rev_parse_parse_parent_suffix(spec : String) -> (String, String)?

Parse ^@, ^!, ^-N parent suffixes. Returns (base_spec, suffix_type) where suffix_type is "@", "!", "-N", etc.

#
rewrite_packed_refs

fn rewrite_packed_refs(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, transform : (String) -> String?) -> Unit raise
GitError

#
rm_paths

fn rm_paths(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, paths : Array[String], cached? : Bool, force? : Bool, recursive? : Bool) -> Unit raise
GitError

Remove files from index (and optionally working tree).

#
save_interactive_rebase_state

fn save_interactive_rebase_state(fs : &
FileSystem
, git_dir : String, state : InteractiveRebaseState) -> Unit raise
GitError

#
serialize_interactive_todo

fn serialize_interactive_todo(entries : Array[InteractiveTodoEntry]) -> String

#
set_config_key

fn set_config_key(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, section : String, name : String, key : String, value : String) -> Unit raise
GitError

#
shell_single_quote

fn shell_single_quote(value : String) -> String

Shell-escape a value with single quotes.

#
shorten_oid_hex

fn shorten_oid_hex(hex : String, requested : Int) -> String

Shorten a hex OID to the requested length (minimum 4).

#
should_log_ref

fn should_log_ref(fs : &
RepoFileSystem
, git_dir : String, refname : String, is_bare : Bool) -> (Bool, Bool) raise
GitError

Check if reflogs should be created for a ref based on config. Returns: (should_log, always_log)
  • should_log: true if this ref should have reflogs
  • always_log: true if core.logAllRefUpdates=always

#
show_ref

List all refs (loose + packed).

#
show_ref_text

fn show_ref_text(fs : &
RepoFileSystem
, git_dir : String) -> Array[String] raise
GitError

Format like git show-ref output.

#
smudge_for_checkout

fn smudge_for_checkout(content : Bytes, attrs : FileEolAttrs, autocrlf : AutoCrlf, core_eol? : EolAttr) -> Bytes

Smudge: blob→WT expansion considering gitattributes text/eol.

#
smudge_worktree_content

fn smudge_worktree_content(content : Bytes, autocrlf : AutoCrlf) -> Bytes

Smudge: blob→working tree expansion.

#
sort_branch_configs_by_name

fn sort_branch_configs_by_name(items : Array[BranchConfig]) -> Unit

#
sort_strings_lex

fn sort_strings_lex(items : Array[String]) -> Unit

#
sparse_checkout_add

fn sparse_checkout_add(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, new_patterns : Array[String]) -> Unit raise
GitError

Add patterns to sparse checkout.

#
sparse_checkout_disable

Disable sparse checkout.

#
sparse_checkout_init

fn sparse_checkout_init(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, cone? : Bool) -> Unit raise
GitError

Initialize sparse checkout.

#
sparse_checkout_reapply

#
sparse_checkout_set

fn sparse_checkout_set(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, patterns : Array[String]) -> Unit raise
GitError

Set sparse checkout patterns (replaces existing patterns).

#
sparse_default_patterns

fn sparse_default_patterns() -> Array[String]

#
sparse_set_cone_config

fn sparse_set_cone_config(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, value : Bool) -> Unit raise
GitError

#
sparse_set_index_sparse_config

fn sparse_set_index_sparse_config(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, value : Bool) -> Unit raise
GitError

#
split_config_key

fn split_config_key(full_key : String, section : String) -> (String, String)?

#
split_whitespace_all

fn split_whitespace_all(s : String) -> Array[String]

#
stash_apply

fn stash_apply(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, index : Int, drop : Bool) -> Unit raise
GitError

Apply stash entry (optionally dropping it).

#
stash_collect_paths

fn stash_collect_paths(parent_files : Map[String, TreeFileEntry], stash_files : Map[String, TreeFileEntry]) -> Array[String]

Collect sorted union of paths from two tree file maps.

#
stash_drop

Drop stash entry at index.

#
stash_list

List all stash entries.

#
stash_mode_str

fn stash_mode_str(mode : Int) -> String

Convert Int mode to String representation.

#
stash_push

async fn stash_push(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, message : String, author : String, timestamp : Int64) ->
ObjectId
? raise
GitError

Push current changes to stash.

#
stash_push_patch

async fn stash_push_patch(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, message : String, author : String, timestamp : Int64, select_hunk : async (StashPatchHunk, Int, Int) -> Bool) ->
ObjectId
? raise
GitError

#
status

async fn status(fs : &
RepoFileSystem
, root : String, run_filter_cmd? : FilterCmd) -> Status raise
GitError

Get status similar to git status --porcelain buckets.

#
status_porcelain

async fn status_porcelain(fs : &
RepoFileSystem
, root : String) -> Array[String] raise
GitError

Format status in porcelain-like lines.

#
status_porcelain_from

fn status_porcelain_from(s : Status) -> Array[String]

#
status_text

async fn status_text(fs : &
RepoFileSystem
, root : String) -> String raise
GitError

Format status output similar to git status.

#
subdir_remove_dir

fn subdir_remove_dir(rfs : &
RepoFileSystem
, wfs : &
FileSystem
, path : String) -> Unit

#
switch_branch

fn switch_branch(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, name : String, create? : Bool, checkout_files? : Bool) -> Unit raise
GitError

Switch HEAD to a branch, optionally creating it and checking out files.

#
tree_files_to_index

#
unlock_worktree

fn unlock_worktree(fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, worktree_path : String) -> Unit raise
GitError

Unlock a worktree.

#
update_fetch_refspec

fn update_fetch_refspec(spec : String, old_name : String, new_name : String) -> String

#
update_follow_remote_head

fn update_follow_remote_head(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, name : String) -> Unit raise
GitError

#
update_subdir_base

fn update_subdir_base(wfs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, new_base : String) -> Unit

Update subdir-base in .git/info/attributes

#
upload_pack

#
upload_pack_v2

Handle protocol v2 upload-pack request

#
working_files_cache

fn working_files_cache(root : String) -> Array[String]?

#
write_index_entries

fn write_index_entries(fs : &
FileSystem
, git_dir : String, entries : Array[IndexEntry], hash_size? : Int) -> Unit raise
GitError

#
write_index_entries_preserving_cache_tree

fn write_index_entries_preserving_cache_tree(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, entries : Array[IndexEntry]) -> Unit raise
GitError

#
write_index_entries_with_flags

fn write_index_entries_with_flags(fs : &
FileSystem
, git_dir : String, entries : Array[IndexEntry], skip_worktree_paths : Map[String, Bool], assume_unchanged_paths : Map[String, Bool], hash_size? : Int) -> Unit raise
GitError

#
write_index_entries_with_skip_worktree

fn write_index_entries_with_skip_worktree(fs : &
FileSystem
, git_dir : String, entries : Array[IndexEntry], skip_worktree_paths : Map[String, Bool], hash_size? : Int) -> Unit raise
GitError

#
write_index_entries_with_tree

#
write_index_stage_entries

fn write_index_stage_entries(fs : &
FileSystem
, git_dir : String, entries : Array[IndexStageEntry], hash_size? : Int) -> Unit raise
GitError

#
write_object_bytes

fn write_object_bytes(fs : &
FileSystem
, git_dir : String, id :
ObjectId
, compressed : Bytes) -> Unit raise
GitError

#
write_skip_worktree_paths

fn write_skip_worktree_paths(fs : &
FileSystem
, git_dir : String, paths : Array[String]) -> Unit raise
GitError

#
write_sparse_patterns

fn write_sparse_patterns(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, patterns : Array[String]) -> Unit raise
GitError

Write sparse checkout patterns to .git/info/sparse-checkout.

#
write_subdir_attributes

fn write_subdir_attributes(fs : &
FileSystem
, git_dir : String, remote_url : String, subdir_path : String, base_commit :
ObjectId
) -> Unit

Write subdir-clone metadata to .git/info/attributes

#
write_tree_from_index

#
write_tree_to_worktree

#
write_worktree_and_build_index

fn write_worktree_and_build_index(db : ObjectDb, fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, git_dir : String, files : Map[String, TreeFileEntry], remove_missing? : Bool, preserve_removed_gitlinks? : Bool) -> Array[IndexEntry] raise
GitError

Combined worktree write + index build — reads each blob only once.

#
write_worktree_from_files

fn write_worktree_from_files(db : ObjectDb, fs : &
FileSystem
, rfs : &
RepoFileSystem
, root : String, git_dir : String, files : Map[String, TreeFileEntry], remove_missing? : Bool, preserve_removed_gitlinks? : Bool) -> Unit raise
GitError