Skip to main content

Crate grit_lib

Crate grit_lib 

Source
Expand description

Gust library — core Git-compatible engine.

§Architecture

All Git-compatible logic lives here; the grit binary is a thin CLI shim that parses arguments and delegates to types exposed from this crate.

§Modules

  • error — shared error types using thiserror
  • objects — object ID, object kinds, and in-memory representations
  • odb — loose object store (read/write zlib-compressed objects)
  • repo — repository discovery and handle
  • index — Git index (staging area) read/write
  • ignore — ignore/exclude pattern matching for check-ignore
  • refs — reference storage (files backend)

Modules§

attributes
Gitattributes parsing and pattern matching for check-attr and validation.
bloom
Changed-path Bloom filters for commit-graph files (Git bloom.c compatible).
branch_ref_format
git branch --format subset for t3203: atoms and nested-safe %(if)...%(then)...%(else)...%(end).
branch_tracking
Branch vs remote-tracking comparison for status, checkout, and commit (matches git/remote.c).
check_ref_format
Ref-name validation — git check-ref-format rules.
combined_diff_patch
Git-style combined merge diff hunks (diff --cc / diff --combined).
combined_tree_diff
Multi-parent combined tree diff (Git diff_tree_paths / find_paths_multitree).
commit_encoding
Git commit encoding labels (encoding header, i18n.commitEncoding) mapped to codecs.
commit_graph_file
Parsing Git commit-graph files and Bloom filter lookup (commit-graph.c / bloom.c compatible).
commit_graph_write
Serialize Git commit-graph v1 files with GDA2 + optional Bloom chunks (commit-graph.c compatible).
commit_pretty
Human-oriented commit one-line formats shared by porcelain commands.
commit_trailers
Cherry-pick / sign-off trailer handling compatible with Git’s sequencer.c and trailer.c.
config
Git-compatible configuration file parser and accessor.
connectivity
Reachability checks for push / receive-pack connectivity verification.
crlf
CRLF / EOL conversion and clean/smudge filter support.
delta_encode
Encode Git pack binary deltas (format decoded by crate::unpack_objects::apply_delta).
diff
Diff machinery — compare trees, index entries, and working tree files.
diffstat
Git-compatible --stat / diffstat layout (width, name truncation, bar scaling).
dotfile
Git-compatible .git* / NTFS / HFS path checks (path.c, utf8.c).
error
Shared error types for the Gust library.
fast_export
git fast-export stream generation.
fast_import
Minimal git fast-import stream support.
fetch_head
Parsing FETCH_HEAD lines.
fetch_negotiator
Skipping fetch negotiator — mirrors git/negotiator/skipping.c.
fetch_submodules
Logic for git fetch --recurse-submodules (changed-submodule detection and config).
filter_process
Long-running Git filter protocol (filter.<name>.process), matching git-filter v2.
fmt_merge_msg
Merge commit message formatter — git fmt-merge-msg logic.
fsck_standalone
Standalone object fsck for hash-object and similar entry points.
git_binary_base85
Base-85 codec for GIT binary patch sections (matches git/base85.c).
git_column
Git-compatible column layout for long-format status (untracked / ignored lists).
git_date
Git-compatible date parsing and display (ported from Git date.c).
git_path
Git-compatible path normalization and helpers for test-tool path-utils. Logic matches git/path.c (normalize_path_copy, longest_ancestor_length, relative_path, strip_path_suffix) and git/remote.c (relative_url).
gitmodules
.gitmodules validation (Git fsck / submodule-config parity).
hide_refs
transfer.hideRefs / receive.hideRefs / uploadpack.hideRefs matching (Git ref_is_hidden).
hooks
Hook execution utilities.
ident
Git author/committer identity lines (ident in Git’s fsck.c / commit.c).
ident_config
Default identity values from config and the system (Git ident.c).
ident_resolve
Git-compatible author/committer identity resolution (see upstream ident.c).
ignore
Ignore and exclude matching for check-ignore.
index
Git index (staging area) reading and writing.
index_name_hash_lazy
Lazy, optionally multi-threaded index name/dir hash initialization compatible with Git’s name-hash.c (used by test-tool lazy-init-name-hash and regression test t3008).
interpret_trailers
Commit message trailer parsing and rewriting (Git-compatible).
line_log
Line-level history (git log -L) — range tracking across diffs.
ls_remote
ls-remote — enumerate references from a local repository.
mailinfo
Email parsing for mailinfo (aligned with Git’s mailinfo.c for t5100-mailinfo).
mailmap
Parse .mailmap and resolve author/committer identities (Git-compatible).
merge_base
Merge-base and reachability primitives.
merge_diff
Merge commit and combined (--cc / -c) diff helpers.
merge_file
Three-way file merge — the engine behind grit merge-file.
merge_tree_trivial
Trivial three-tree merge for git merge-tree (no --write-tree).
merge_trees
Rename-aware three-way tree merge for cherry-pick / revert style merges.
mergetool_vimdiff
Vimdiff merge tool layout generation compatible with Git’s mergetools/vimdiff driver.
midx
Multi-pack-index (MIDX) file writing and minimal reading.
name_rev
Name-rev: name commits relative to refs.
objects
Git object model: object IDs, kinds, and in-memory representations.
odb
Loose object database: reading and writing zlib-compressed Git objects.
pack
Pack and pack-index helpers for object counting and verification.
pack_geometry
Pack geometry for git repack --geometric (factor-based progression).
pack_name_hash
Git pack bitmap name-hash functions (pack_name_hash / pack_name_hash_v2).
pack_rev
On-disk pack reverse index (.rev) — RIDX format matching Git’s pack-write.c.
parse_options_test_tool
Git-compatible parse-options surface used by test-tool parse-options and related helpers (parse-options-flags, parse-subcommand). Matches git/t/helper/test-parse-options.c.
patch_ids
Patch-ID computation for commit equivalence detection.
path_walk
Path-batched object graph walk matching Git’s walk_objects_by_path / test-tool path-walk.
pathspec
Git-compatible pathspec matching (magic tokens and global flags).
pkt_line
Git pkt-line format helpers.
precompose_config
Read core.precomposeunicode without opening a full [Repository].
promisor
Partial-clone promisor bookkeeping used by Grit.
protocol
Protocol allow/deny policy.
prune_packed
Library implementation of prune-packed.
push_submodules
Submodule recursion for git push (--recurse-submodules).
quote_path
C-style path quoting compatible with Git’s quote.c / core.quotepath.
receive_pack
Receive-pack configuration and pack-header helpers.
ref_exclusions
Reference exclusion rules for rev-list / rev-parse (--exclude, --exclude-hidden).
ref_namespace
Git GIT_NAMESPACE handling: map logical ref names to storage under refs/namespaces/.../.
reflog
Reflog reading and management.
refs
Reference storage — files backend + reftable backend.
refs_fsck
Reference database consistency checks for git refs verify and git fsck --references.
reftable
Reftable format — binary reference storage.
repo
Repository discovery and the primary Repository handle.
rerere
Git-compatible rerere (MERGE_RR, rr-cache/, conflict ID hashing).
resolve_undo
Git index REUC (resolve-undo) extension — records unmerged stages when a conflict is resolved.
rev_list
Commit traversal and output planning for rev-list.
rev_parse
Revision parsing and repository discovery helpers for rev-parse.
shallow
Shallow repository metadata (.git/shallow).
shared_repo
Shared-repository permission helpers (core.sharedRepository, --shared).
simple_ipc
Git-compatible “simple IPC” over Unix domain sockets using pkt-line framing.
sparse_checkout
Sparse-checkout pattern parsing and path membership (cone and non-cone).
split_index
Split index: link extension and sharedindex.<sha1> (Git split-index.c).
state
Repository state machine — HEAD resolution, branch status, and in-progress operation detection.
stripspace
Core logic for git stripspace.
submodule_active
Submodule “active” state (submodule.c is_submodule_active parity).
submodule_config
Submodule registration and activation (Git submodule.c parity for tooling).
submodule_config_cache
Submodule configuration cache (Git submodule-config.c subset for test-tool).
submodule_gitdir
Submodule gitdir paths when extensions.submodulePathConfig is enabled.
tab_expand
Expand tab characters in commit log output to spaces, matching Git’s strbuf_add_tabexpand.
test_tool_progress
test-tool progress — exercises Git-compatible progress display (t0500).
textconv_cache
Git-compatible diff.<driver>.cachetextconv storage under refs/notes/textconv/<driver>.
transport_path
Safety checks for local transport URLs (matches Git connect.c / path.c).
tree_path_follow
Resolve tree paths with symlink following (get_tree_entry_follow_symlinks).
unicode_normalization
UTF-8 NFC path normalization for macOS-style filesystems (core.precomposeUnicode).
unix_process
Unix-only process helpers (FFI).
unpack_objects
unpack-objects: unpack a pack stream into loose objects.
untracked_cache
Git index UNTR (untracked cache) — git/dir.c / read-cache.c.
url_rewrite
URL rewrite helpers for url.*.insteadOf / url.*.pushInsteadOf.
userdiff
User-defined and built-in diff function-name matching.
whitespace_rule
Git-compatible core.whitespace rules and ws_fix_copy (git/ws.c).
wildmatch
Git-compatible wildmatch pattern matching.
worktree_cwd
Process current working directory relative to a Git work tree.
write_tree
Build tree objects from index entries (git write-tree core logic).
ws
Git-compatible whitespace rules (core.whitespace, whitespace attribute).