Skip to main content

Crate sley_notes

Crate sley_notes 

Source
Expand description

Git notes: read and write the tree-backed mapping from annotated object to note blob, reachable from refs/notes/*.

Notes trees may use git’s fanout layout (two-hex-digit subtrees); this crate reads any fanout depth and writes either flat trees or Git-compatible one-level fanout trees once the note count is large enough.

Structs§

Note
A single note: annotated object oid and the note blob oid.
NotesCommitIdentity
Author/committer lines for the notes commit (raw git identity bytes).
NotesIter
Lazy iterator over notes reachable from notes_ref.
NotesMergeConflict
One unresolved note-level conflict from a notes merge.
NotesRef
A fully-qualified notes ref name (e.g. refs/notes/commits).

Enums§

NotesMergeOutcome
Result of merging one notes ref into another.
NotesMergeStrategy
Conflict resolution strategy for git notes merge.
RemoveNoteOutcome
Result of an incremental note removal at the repository level.
UpsertNoteOutcome
Result of an incremental note upsert at the repository level.

Constants§

DEFAULT_NOTES_REF
Default notes ref when none is selected via GIT_NOTES_REF or core.notesRef.

Functions§

finalize_notes_merge
Finalize a previous conflicting notes merge by adding resolved worktree entries to the partial notes tree and creating the final merge commit.
iter_notes
Stream notes from notes_ref without materializing the full list.
list_notes
List every note reachable from notes_ref, sorted by annotated-object hex.
merge_notes
Merge remote_ref into local_ref, matching Git’s note-level three-way merge rules. The caller is responsible for persisting conflict worktree files when NotesMergeOutcome::Conflicted is returned.
notes_ref_expected
Derive the compare-and-swap precondition used by legacy full-replace callers: Some when the notes ref exists as a direct oid, otherwise None (create-only).
notes_tree_oid
Peel notes_ref to its root tree oid. Returns None when the ref is absent.
read_note
Return the note blob oid for annotated, if any.
read_note_bytes
Return the note body bytes for annotated, if a note exists.
read_note_for
Return the note blob oid for annotated, if any (fanout-aware, no full scan).
read_note_from_tree
Return the note blob oid for annotated from an already-resolved notes tree.
remove_note
Remove the note for annotated from an in-memory note list, if present.
remove_note_for
Remove the note for a single annotated object, if present.
remove_notes_for
Remove notes for annotated in a single fast-forward commit when any are present. Returns RemoveNoteOutcome::Unchanged when the ref is absent or none of the oids have notes.
resolve_notes_ref
Resolve the notes ref using git’s precedence: explicit override, then GIT_NOTES_REF, then core.notesRef, then DEFAULT_NOTES_REF.
resolve_notes_ref_with_config
Like resolve_notes_ref, but resolves core.notesRef against a caller-supplied effective config instead of re-reading <git_dir>/config blindly.
upsert_note
Replace (or insert) the note for annotated inside an in-memory note list.
upsert_note_bytes_for
Write body as a blob, then call upsert_note_for.
upsert_note_for
Incrementally upsert a single note, reading any fanout layout and writing a flat sorted tree. Returns UpsertNoteOutcome::Unchanged when annotated already maps to blob.
write_notes
Rewrite the notes tree to exactly notes and advance notes_ref to a new commit. An empty set still records a commit on the empty tree.