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 flat (un-fanned) trees, which git reads back identically.
Structs§
- Note
- A single note: annotated object oid and the note blob oid.
- Notes
Commit Identity - Author/committer lines for the notes commit (raw git identity bytes).
- Notes
Iter - Lazy iterator over notes reachable from
notes_ref. - Notes
Ref - A fully-qualified notes ref name (e.g.
refs/notes/commits).
Enums§
- Remove
Note Outcome - Result of an incremental note removal at the repository level.
- Upsert
Note Outcome - Result of an incremental note upsert at the repository level.
Constants§
- DEFAULT_
NOTES_ REF - Default notes ref when none is selected via
GIT_NOTES_REForcore.notesRef.
Functions§
- iter_
notes - Stream notes from
notes_refwithout materializing the full list. - list_
notes - List every note reachable from
notes_ref, sorted by annotated-object hex. - notes_
ref_ expected - Derive the compare-and-swap precondition used by legacy full-replace callers:
Somewhen the notes ref exists as a direct oid, otherwiseNone(create-only). - notes_
tree_ oid - Peel
notes_refto its root tree oid. ReturnsNonewhen 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). - remove_
note - Remove the note for
annotatedfrom 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
annotatedin a single fast-forward commit when any are present. ReturnsRemoveNoteOutcome::Unchangedwhen 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, thencore.notesRef, thenDEFAULT_NOTES_REF. - resolve_
notes_ ref_ with_ config - Like
resolve_notes_ref, but resolvescore.notesRefagainst a caller-supplied effective config instead of re-reading<git_dir>/configblindly. - upsert_
note - Replace (or insert) the note for
annotatedinside an in-memory note list. - upsert_
note_ bytes_ for - Write
bodyas a blob, then callupsert_note_for. - upsert_
note_ for - Incrementally upsert a single note, reading any fanout layout and writing a
flat sorted tree. Returns
UpsertNoteOutcome::Unchangedwhenannotatedalready maps toblob. - write_
notes - Rewrite the notes tree to exactly
notesand advancenotes_refto a new commit. An empty set still records a commit on the empty tree.