Skip to main content

Module notes

Module notes 

Source
Expand description

git notes tree manipulation — the fanout tree mapping object -> note blob.

Notes are stored as blobs in a tree referenced by refs/notes/commits (or a custom namespace via --ref). Each leaf in the notes tree is named by the full hex SHA of the annotated object, optionally split into a fanout layout (ab/cd/ef…) once the note count grows large.

This module owns the pure tree operations over the object database: reading the notes tree into a flat entry list, computing the fanout layout, writing a new notes tree + commit, combining note blobs (concatenate / cat_sort_uniq), and the notes-merge data model (pairing local/remote/base changes and applying a merge strategy). The grit binary keeps argument parsing, editor launch, stdin reading, output, and exit-code mapping.

Structs§

NotesTreeEntry

Enums§

NotesMergeStrategy

Constants§

NOTES_MERGE_WORKTREE
Per-worktree subdirectory holding the conflicted note blobs during a notes merge.

Functions§

combine_notes_cat_sort_uniq
Matches Git’s combine_notes_cat_sort_uniq: all lines from both blobs, de-duplicated and sorted.
combine_notes_concatenate
Matches Git’s combine_notes_concatenate: join two note blobs with a blank line between them.
display_note_path
expand_notes_ref
Match Git’s expand_notes_ref (notes.c): only --ref uses this; env/config refs are verbatim.
note_object_name
notes_merge_git_dir
Per-worktree git directory for NOTES_MERGE_* (main: .git/, linked: .git/worktrees/<id>/).
notes_merge_inner
notes_merge_worktree_nonempty
True when NOTES_MERGE_WORKTREE exists and is not empty (matches Git is_empty_dir).
notes_merge_worktree_path
parse_notes_merge_strategy_value
read_notes_tree
Read the notes tree entries from the notes ref. Returns an empty vec if the ref doesn’t exist yet.
upsert_note_entry
write_notes_commit
Write a new notes tree and commit, updating the notes ref.
write_notes_commit_with_parents