diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-12-22 11:27:29 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-12-22 11:27:29 -0800 |
commit | e927c1675171a24823c8683fd48768024795c996 (patch) | |
tree | a7098e96643c4a31c273133097f468c93ccd8cac /builtin | |
parent | c735ce4a1d6298028388299deaa10b1426c2e5fc (diff) | |
parent | 78e98eaf5ee49bc6d62ef9bdf87066528bfba248 (diff) | |
download | git-e927c1675171a24823c8683fd48768024795c996.tar.gz |
Merge branch 'rs/diff-tree-combined-clean-up'
* rs/diff-tree-combined-clean-up:
submodule: use diff_tree_combined_merge() instead of diff_tree_combined()
pass struct commit to diff_tree_combined_merge()
use struct sha1_array in diff_tree_combined()
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/diff.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/builtin/diff.c b/builtin/diff.c index 0fe638fc45..387afa7568 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -14,6 +14,7 @@ #include "log-tree.h" #include "builtin.h" #include "submodule.h" +#include "sha1-array.h" struct blobinfo { unsigned char sha1[20]; @@ -169,7 +170,7 @@ static int builtin_diff_combined(struct rev_info *revs, struct object_array_entry *ent, int ents) { - const unsigned char (*parent)[20]; + struct sha1_array parents = SHA1_ARRAY_INIT; int i; if (argc > 1) @@ -177,12 +178,11 @@ static int builtin_diff_combined(struct rev_info *revs, if (!revs->dense_combined_merges && !revs->combine_merges) revs->dense_combined_merges = revs->combine_merges = 1; - parent = xmalloc(ents * sizeof(*parent)); - for (i = 0; i < ents; i++) - hashcpy((unsigned char *)(parent + i), ent[i].item->sha1); - diff_tree_combined(parent[0], parent + 1, ents - 1, + for (i = 1; i < ents; i++) + sha1_array_append(&parents, ent[i].item->sha1); + diff_tree_combined(ent[0].item->sha1, &parents, revs->dense_combined_merges, revs); - free((void *)parent); + sha1_array_clear(&parents); return 0; } |