summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-08-11 20:26:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-11 20:26:56 (GMT)
commitc7528f4d8a2b8e4bf843b3eb95d2b7899a38c1fa (patch)
treef844bdf385f2f7cdd78ee77e3ce7b312da62e8ce
parentdf422678a800ffb1db8f3f146e2786f1cbf0059b (diff)
parentf730944a49b2a210bb10520700c0a3f6c49bc020 (diff)
downloadgit-c7528f4d8a2b8e4bf843b3eb95d2b7899a38c1fa.zip
git-c7528f4d8a2b8e4bf843b3eb95d2b7899a38c1fa.tar.gz
git-c7528f4d8a2b8e4bf843b3eb95d2b7899a38c1fa.tar.bz2
Merge branch 'bw/object-id'
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
-rw-r--r--builtin/notes.c2
-rw-r--r--builtin/receive-pack.c2
-rw-r--r--tree-diff.c5
3 files changed, 5 insertions, 4 deletions
diff --git a/builtin/notes.c b/builtin/notes.c
index 77573cf..4303848 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -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))
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 136c44d..14b6e09 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -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);
diff --git a/tree-diff.c b/tree-diff.c
index bd6d65a..2357f72 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -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);