summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRichard Ipsum <richardipsum@fastmail.co.uk>2017-09-23 17:46:46 +0100
committerRichard Ipsum <richardipsum@fastmail.co.uk>2017-10-07 00:31:54 +0100
commita46e743d0153b9a565614776b9f3a71e0aebff25 (patch)
treed769167f466dacc8b08259774a9fa06c4e6d0778 /include
parent5b1641fb22111b36f47dd2cacb9b06ace3a6d9cb (diff)
downloadlibgit2-a46e743d0153b9a565614776b9f3a71e0aebff25.tar.gz
notes: Add git_note_commit_create
This adds a new function that will allow creation of notes without necessarily updating a particular ref, the notes tree is obtained from the git_commit object parameter, a new commit object pointing to the current tip of the notes tree is optionally returned via the 'note_commit_out' parameter, optionally the blob id for the note is returned through the 'note_blob_out' object.
Diffstat (limited to 'include')
-rw-r--r--include/git2/notes.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/git2/notes.h b/include/git2/notes.h
index 3a626cafd..1af43a89b 100644
--- a/include/git2/notes.h
+++ b/include/git2/notes.h
@@ -153,6 +153,36 @@ GIT_EXTERN(int) git_note_create(
const char *note,
int force);
+/**
+ * Add a note for an object from a commit
+ *
+ * This function will create a notes commit for a given object,
+ * the commit is a dangling commit, no reference is created.
+ *
+ * @param notes_commit_out pointer to store the commit (optional);
+ * NULL in case of error
+ * @param notes_blob_out a point to the id of a note blob (optional)
+ * @param repo repository where the note will live
+ * @param parent Pointer to parent note
+ * or NULL if this shall start a new notes tree
+ * @param author signature of the notes commit author
+ * @param committer signature of the notes commit committer
+ * @param oid OID of the git object to decorate
+ * @param note Content of the note to add for object oid
+ * @param allow_note_overwrite Overwrite existing note
+ *
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_note_commit_create(
+ git_oid *notes_commit_out,
+ git_oid *notes_blob_out,
+ git_repository *repo,
+ git_commit *parent,
+ const git_signature *author,
+ const git_signature *committer,
+ const git_oid *oid,
+ const char *note,
+ int allow_note_overwrite);
/**
* Remove the note for an object