Expand description
git notes — add or inspect object notes stored in a refs/notes/* namespace.
Notes attach mutable metadata to any git object (commit, blob, tree, tag)
without rewriting it. Each note lives in a ref namespace — the default is
refs/notes/commits, but any namespace works. This wrapper keeps the
namespace raw: pass whatever ref_namespace
value you want (refs/notes/embeddings, a short build, …) and git-spawn
forwards it verbatim via --ref without prepending refs/notes/.
Note payloads can be binary or large (the underlying object is just a blob).
Prefer message_file over
message for such payloads: it reads the bytes from
a file (-F), dodging argument-length limits, and pairs naturally with
no_stripspace for byte-exact round-trips.
§Sharing notes across repositories
Notes refs are not fetched or pushed by default. Because
PushCommand and
FetchCommand accept arbitrary
refspecs, moving a notes namespace between repositories needs no dedicated
method — just name the notes ref:
use git_spawn::{GitCommand, Repository};
use git_spawn::command::notes::NotesCommand;
let repo = Repository::open("/repo")?;
// Attach a note to HEAD in a custom namespace.
repo.notes(NotesCommand::add())
.ref_namespace("refs/notes/test")
.object("HEAD")
.message("reviewed")
.execute()
.await?;
// Publish the namespace to a remote, then fetch it back elsewhere.
repo.push()
.remote("origin")
.refspec("refs/notes/test:refs/notes/test")
.execute()
.await?;
repo.fetch()
.remote("origin")
.refspec("refs/notes/test:refs/notes/test")
.execute()
.await?;Structs§
- Notes
Command - Builder for
git notes.
Enums§
- Notes
Action - Actions supported by
git notes.