- offset = 46;
- while (offset + 48 < size && !memcmp(buf + offset, "parent ", 7)) {
- unsigned char parent[20];
- if (get_sha1_hex(buf + offset + 7, parent))
- return -1;
- header = generate_header(name, sha1_to_hex(parent), buf, size);
- diff_tree_sha1_top(parent, commit, "");
+ for (parents = commit->parents; parents; parents = parents->next) {
+ struct commit *parent = parents->item;
+ header = generate_header(name,
+ sha1_to_hex(parent->object.sha1),
+ commit->buffer);
+ diff_tree_sha1_top(parent->object.sha1, commit_sha1, "");