Skip to main content

Module gitref

Module gitref 

Source
Expand description

Git plumbing for the lore store refs under refs/lore/*.

Every operation shells out to the user’s git binary (no libgit2) so it inherits their authentication, SSH config, credential helpers, and remotes for free. git is already a hard dependency of the project. This mirrors the style of crate::git but uses plumbing commands (hash-object, mktree via a temporary index, commit-tree, update-ref, cat-file, ls-tree) so the store ref lives entirely outside refs/heads/* and never checks out into the working tree.

All functions take an explicit repository path, run with that path as the working directory, capture stderr, and return a SyncError::Git with the command and stderr on failure.

Structs§

TreeEntry
A single entry in a ref’s tree.

Constants§

ZERO_OID
The all-zeros object id git uses to mean “this ref does not yet exist”.

Functions§

add_lore_fetch_refspec
Adds a tracking-namespace lore fetch refspec to a remote’s config (opt-in).
build_tree
Builds a new tree incrementally and returns its object SHA.
commit_tree
Creates a commit object for a tree and returns its SHA.
fetch
Fetches a lore ref from a remote into its remote-tracking ref.
push
Pushes a lore ref to a remote using an explicit refspec.
read_blob
Reads the bytes of a blob by its object SHA.
read_tracking_tree
Reads the tree of a lore ref’s remote-tracking ref.
read_tree
Reads the full (recursive) tree of a ref as a list of blob entries.
ref_exists
Returns whether a ref exists in the repository.
remote_ref_exists
Returns whether a remote advertises ref_name, without fetching.
resolve_ref
Resolves a ref to its commit SHA, or None if the ref does not exist.
resolve_tree
Resolves a ref to its tree SHA, or None if the ref does not exist.
tracking_ref_name
Computes the remote-tracking ref name for a lore ref.
update_ref
Points a ref at a commit.
update_ref_checked
Points a ref at a commit only if it currently holds the expected value.
write_blob
Writes raw bytes as a git blob and returns its object SHA.