diff options
author | Richard Ipsum <richardipsum@fastmail.co.uk> | 2017-03-15 11:54:45 +0000 |
---|---|---|
committer | Richard Ipsum <richardipsum@fastmail.co.uk> | 2017-10-07 00:33:23 +0100 |
commit | 7096bf1ef6b5c7c5659ea9d8c66c85bda8ef20db (patch) | |
tree | fcdc597c361623f78e3913b07eb9910ec35c0362 /src/notes.c | |
parent | a46e743d0153b9a565614776b9f3a71e0aebff25 (diff) | |
download | libgit2-7096bf1ef6b5c7c5659ea9d8c66c85bda8ef20db.tar.gz |
notes: Add git_note_commit_read
This also adds tests for this function.
Diffstat (limited to 'src/notes.c')
-rw-r--r-- | src/notes.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/notes.c b/src/notes.c index 9bace25f4..35ba93d7c 100644 --- a/src/notes.c +++ b/src/notes.c @@ -463,6 +463,28 @@ int git_note_read(git_note **out, git_repository *repo, return error; } +int git_note_commit_read( + git_note **out, + git_repository *repo, + git_commit *notes_commit, + const git_oid *oid) +{ + int error; + git_tree *tree = NULL; + char target[GIT_OID_HEXSZ + 1]; + + git_oid_tostr(target, sizeof(target), oid); + + if ((error = git_commit_tree(&tree, notes_commit)) < 0) + goto cleanup; + + error = note_lookup(out, repo, notes_commit, tree, target); + +cleanup: + git_tree_free(tree); + return error; +} + int git_note_create( git_oid *out, git_repository *repo, |