notes: make get_note return pointer to struct object_id

Make get_note return a pointer to a const struct object_id.  Add a
defensive check to ensure we don't accidentally dereference a NULL
pointer.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2017-05-30 10:30:40 -07:00
committed by Junio C Hamano
parent 490bc83a01
commit 9ef7223058
5 changed files with 28 additions and 28 deletions

View File

@@ -140,7 +140,7 @@ int remove_note(struct notes_tree *t, const unsigned char *object_sha1);
*
* Return NULL if the given object has no notes.
*/
const unsigned char *get_note(struct notes_tree *t,
const struct object_id *get_note(struct notes_tree *t,
const unsigned char *object_sha1);
/*