fsck: test & document {fetch,receive}.fsck.* config fallback
[gitweb.git] / notes-utils.c
index 9765deb41ab02dba909ec9027701bf2fdc53f310..02407fe2a7327947dda6bf755405d2778ae450ae 100644 (file)
@@ -6,19 +6,19 @@
 
 void create_notes_commit(struct notes_tree *t, struct commit_list *parents,
                         const char *msg, size_t msg_len,
-                        unsigned char *result_sha1)
+                        struct object_id *result_oid)
 {
        struct object_id tree_oid;
 
        assert(t->initialized);
 
-       if (write_notes_tree(t, tree_oid.hash))
+       if (write_notes_tree(t, &tree_oid))
                die("Failed to write notes tree to database");
 
        if (!parents) {
                /* Deduce parent commit from t->ref */
                struct object_id parent_oid;
-               if (!read_ref(t->ref, parent_oid.hash)) {
+               if (!read_ref(t->ref, &parent_oid)) {
                        struct commit *parent = lookup_commit(&parent_oid);
                        if (parse_commit(parent))
                                die("Failed to find/parse commit %s", t->ref);
@@ -27,7 +27,8 @@ void create_notes_commit(struct notes_tree *t, struct commit_list *parents,
                /* else: t->ref points to nothing, assume root/orphan commit */
        }
 
-       if (commit_tree(msg, msg_len, tree_oid.hash, parents, result_sha1, NULL, NULL))
+       if (commit_tree(msg, msg_len, &tree_oid, parents, result_oid, NULL,
+                       NULL))
                die("Failed to commit notes tree to database");
 }
 
@@ -47,9 +48,9 @@ void commit_notes(struct notes_tree *t, const char *msg)
        strbuf_addstr(&buf, msg);
        strbuf_complete_line(&buf);
 
-       create_notes_commit(t, NULL, buf.buf, buf.len, commit_oid.hash);
+       create_notes_commit(t, NULL, buf.buf, buf.len, &commit_oid);
        strbuf_insert(&buf, 0, "notes: ", 7); /* commit message starts at index 7 */
-       update_ref(buf.buf, t->update_ref, commit_oid.hash, NULL, 0,
+       update_ref(buf.buf, t->update_ref, &commit_oid, NULL, 0,
                   UPDATE_REFS_DIE_ON_ERR);
 
        strbuf_release(&buf);