diff options
Diffstat (limited to 'patch-ids.c')
-rw-r--r-- | patch-ids.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/patch-ids.c b/patch-ids.c index 5717257051..b7b3e5a1a7 100644 --- a/patch-ids.c +++ b/patch-ids.c @@ -8,10 +8,10 @@ static int commit_patch_id(struct commit *commit, struct diff_options *options, unsigned char *sha1) { if (commit->parents) - diff_tree_sha1(commit->parents->item->object.sha1, - commit->object.sha1, "", options); + diff_tree_sha1(commit->parents->item->object.oid.hash, + commit->object.oid.hash, "", options); else - diff_root_tree_sha1(commit->object.sha1, "", options); + diff_root_tree_sha1(commit->object.oid.hash, "", options); diffcore_std(options); return diff_flush_patch_id(options, sha1); } @@ -39,8 +39,7 @@ int init_patch_ids(struct patch_ids *ids) memset(ids, 0, sizeof(*ids)); diff_setup(&ids->diffopts); DIFF_OPT_SET(&ids->diffopts, RECURSIVE); - if (diff_setup_done(&ids->diffopts) < 0) - return error("diff_setup_done failed"); + diff_setup_done(&ids->diffopts); return 0; } @@ -84,10 +83,7 @@ static struct patch_id *add_commit(struct commit *commit, ent = &bucket->bucket[bucket->nr++]; hashcpy(ent->patch_id, sha1); - if (ids->alloc <= ids->nr) { - ids->alloc = alloc_nr(ids->nr); - ids->table = xrealloc(ids->table, sizeof(ent) * ids->alloc); - } + ALLOC_GROW(ids->table, ids->nr + 1, ids->alloc); if (pos < ids->nr) memmove(ids->table + pos + 1, ids->table + pos, sizeof(ent) * (ids->nr - pos)); |