diff options
author | Richard Ipsum <richardipsum@fastmail.co.uk> | 2017-09-23 17:25:26 +0100 |
---|---|---|
committer | Richard Ipsum <richardipsum@fastmail.co.uk> | 2017-09-23 17:48:53 +0100 |
commit | 5b1641fb22111b36f47dd2cacb9b06ace3a6d9cb (patch) | |
tree | 7634b711ba3c37c14ca6774ca354c85b6fa2b3b8 | |
parent | ffd4df6bf21562b94c27eb356df991f23a88c87b (diff) | |
download | libgit2-5b1641fb22111b36f47dd2cacb9b06ace3a6d9cb.tar.gz |
notes: Make note_write return commit oid
For the new 'commit' API it will be necessary to know the OID
of the notes commit that was written as well as the OID of the notes blob.
-rw-r--r-- | src/notes.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/notes.c b/src/notes.c index 75108b9c9..bed489014 100644 --- a/src/notes.c +++ b/src/notes.c @@ -268,7 +268,9 @@ static int insert_note_in_tree_enotfound_cb(git_tree **out, GIT_FILEMODE_BLOB); } -static int note_write(git_oid *out, +static int note_write( + git_oid *notes_commit_out, + git_oid *notes_blob_out, git_repository *repo, const git_signature *author, const git_signature *committer, @@ -294,13 +296,17 @@ static int note_write(git_oid *out, insert_note_in_tree_enotfound_cb)) < 0) goto cleanup; - if (out) - git_oid_cpy(out, &oid); + if (notes_blob_out) + git_oid_cpy(notes_blob_out, &oid); + error = git_commit_create(&oid, repo, notes_ref, author, committer, NULL, GIT_NOTES_DEFAULT_MSG_ADD, tree, *parents == NULL ? 0 : 1, (const git_commit **) parents); + if (notes_commit_out) + git_oid_cpy(notes_commit_out, &oid); + cleanup: git_tree_free(tree); return error; @@ -480,7 +486,7 @@ int git_note_create( if (error < 0 && error != GIT_ENOTFOUND) goto cleanup; - error = note_write(out, repo, author, committer, notes_ref, + error = note_write(NULL, out, repo, author, committer, notes_ref, note, tree, target, &commit, allow_note_overwrite); cleanup: |