| 1758 | } |
| 1759 | |
| 1760 | static int is_original_commit_empty(struct commit *commit) |
| 1761 | { |
| 1762 | const struct object_id *ptree_oid; |
| 1763 | |
| 1764 | if (repo_parse_commit(the_repository, commit)) |
| 1765 | return error(_("could not parse commit %s"), |
| 1766 | oid_to_hex(&commit->object.oid)); |
| 1767 | if (commit->parents) { |
| 1768 | struct commit *parent = commit->parents->item; |
| 1769 | if (repo_parse_commit(the_repository, parent)) |
| 1770 | return error(_("could not parse parent commit %s"), |
| 1771 | oid_to_hex(&parent->object.oid)); |
| 1772 | ptree_oid = get_commit_tree_oid(parent); |
| 1773 | } else { |
| 1774 | ptree_oid = the_hash_algo->empty_tree; /* commit is root */ |
| 1775 | } |
| 1776 | |
| 1777 | return oideq(ptree_oid, get_commit_tree_oid(commit)); |
| 1778 | } |
| 1779 | |
| 1780 | /* |
| 1781 | * Should empty commits be allowed? Return status: |
no test coverage detected