notes: convert init_notes to use struct object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Sep 5, 2016 at 20:08 UTC 13ac141038cda40fcd50d6808aae70b7ef296729
1 file changed +6 -6
notes.c
+6 -6
@@ -993,7 +993,7 @@ const char *default_notes_ref(void)
993 void init_notes(struct notes_tree *t, const char *notes_ref,
994 combine_notes_fn combine_notes, int flags)
995 {
996 - unsigned char sha1[20], object_sha1[20];
996 + struct object_id oid, object_oid;
997 unsigned mode;
998 struct leaf_node root_tree;
999
@@ -1017,16 +1017,16 @@ void init_notes(struct notes_tree *t, const char *notes_ref,
1017 t->dirty = 0;
1018
1019 if (flags & NOTES_INIT_EMPTY || !notes_ref ||
1020 - get_sha1_treeish(notes_ref, object_sha1))
1020 + get_sha1_treeish(notes_ref, object_oid.hash))
1021 return;
1022 - if (flags & NOTES_INIT_WRITABLE && read_ref(notes_ref, object_sha1))
1022 + if (flags & NOTES_INIT_WRITABLE && read_ref(notes_ref, object_oid.hash))
1023 die("Cannot use notes ref %s", notes_ref);
1024 - if (get_tree_entry(object_sha1, "", sha1, &mode))
1024 + if (get_tree_entry(object_oid.hash, "", oid.hash, &mode))
1025 die("Failed to read notes tree referenced by %s (%s)",
1026 - notes_ref, sha1_to_hex(object_sha1));
1026 + notes_ref, oid_to_hex(&object_oid));
1027
1028 hashclr(root_tree.key_sha1);
1029 - hashcpy(root_tree.val_sha1, sha1);
1029 + hashcpy(root_tree.val_sha1, oid.hash);
1030 load_subtree(t, &root_tree, t->root, 0);
1031 }
1032