Merge branch 'bw/object-id'
authorJunio C Hamano <gitster@pobox.com>
Fri, 11 Aug 2017 20:26:56 +0000 (13:26 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 11 Aug 2017 20:26:56 +0000 (13:26 -0700)
Conversion from uchar[20] to struct object_id continues.

* bw/object-id:
receive-pack: don't access hash of NULL object_id pointer
notes: don't access hash of NULL object_id pointer
tree-diff: don't access hash of NULL object_id pointer

builtin/notes.c
builtin/receive-pack.c
tree-diff.c
index 77573cf1ea8cb4d998597e265263487e22fde592..4303848e044c9f9c6a12236d887a521316b4fc05 100644 (file)
@@ -456,7 +456,7 @@ static int add(int argc, const char **argv, const char *prefix)
                        oid_to_hex(&object));
        }
 
-       prepare_note_data(&object, &d, note->hash);
+       prepare_note_data(&object, &d, note ? note->hash : NULL);
        if (d.buf.len || allow_empty) {
                write_note_data(&d, new_note.hash);
                if (add_note(t, &object, &new_note, combine_notes_overwrite))
index 136c44def778fa64a4a79074413d08aeedcb7991..14b6e09b42f1d423307c98275f5b203078b82445 100644 (file)
@@ -1138,7 +1138,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
                }
                if (ref_transaction_delete(transaction,
                                           namespaced_name,
-                                          old_oid->hash,
+                                          old_oid ? old_oid->hash : NULL,
                                           0, "push", &err)) {
                        rp_error("%s", err.buf);
                        strbuf_release(&err);
index bd6d65a40920a547b9f27512e31341231273fa75..2357f72899f8f47e497ffd1bb66a0d76d7dbe012 100644 (file)
@@ -421,8 +421,9 @@ static struct combine_diff_path *ll_diff_tree_paths(
         *   diff_tree_oid(parent, commit) )
         */
        for (i = 0; i < nparent; ++i)
-               tptree[i] = fill_tree_descriptor(&tp[i], parents_oid[i]->hash);
-       ttree = fill_tree_descriptor(&t, oid->hash);
+               tptree[i] = fill_tree_descriptor(&tp[i],
+                               parents_oid[i] ? parents_oid[i]->hash : NULL);
+       ttree = fill_tree_descriptor(&t, oid ? oid->hash : NULL);
 
        /* Enable recursion indefinitely */
        opt->pathspec.recursive = DIFF_OPT_TST(opt, RECURSIVE);